#/bin/sh # simple script to give a summary of system information # License: LGPLv2 # Author: # http://www.pixelbeat.org/ # Notes: # Unless you run as root, disk info can't be shown # Changes: # V0.1, 16 Nov 2005, Initial release # V0.s, 22 Oct 2007, Tweak to ensure cdrom info shown. # Comment out partition info as a bit noisy. proc find_sbin_cmd { for base in [/ /usr/ /usr/local] { if test -e $base/sbin/$1 { echo $base/sbin/$1 exit } } } setglobal FDISK = $[which fdisk] setglobal LSUSB = $[which lsusb] setglobal LSPCI = $[which lspci] test -z $FDISK && setglobal FDISK = $[find_sbin_cmd fdisk] test -z $LSUSB && setglobal LSUSB = $[find_sbin_cmd lsusb] test -z $LSPCI && setglobal LSPCI = $[find_sbin_cmd lspci] echo "============= Drives =============" shell { sed -n 's/.* \([hs]d[a-f]$\)/\1/p' < /proc/partitions test -e /dev/cdrom && readlink -f /dev/cdrom | cut -d/ -f3 } | sort | uniq | while read disk { echo -n "/dev/$disk: " if test ! -r /dev/$disk { echo "permission denied" #could parse /proc for all but } else { setglobal size = $[$FDISK -l /dev/$disk | grep Disk | cut -d' ' -f3-4 | tr -d ,] setglobal rest = $[/sbin/hdparm -i /dev/$disk 2>/dev/null | grep Model] setglobal rest = $[echo $rest] #strip spaces echo -n $rest if test ! -z $size { echo ", Size=$size" } else { echo } } } #if [ `id -u` == "0" ]; then #echo "========== Partitions ==========" #$FDISK -l 2>/dev/null #fi echo "============= CPUs =============" grep "model name" /proc/cpuinfo #show CPU(s) info echo "============= MEM =============" setglobal KiB = $[grep MemTotal /proc/meminfo | tr -s ' ' | cut -d' ' -f2] setglobal MiB = $[expr $KiB / 1024] #note various mem not accounted for, so round to appropriate size #on my 384MiB system over 8MiB was unaccounted for #on my 1024MiB system over 20MiB was unaccounted for so round to next highest power of 2 setglobal round = '32' echo "$[expr '(' '(' $MiB / $round ')' + 1 ')' '*' $round] MiB" echo "============= PCI =============" $LSPCI -tv echo "============= USB =============" $LSUSB