lspci -b -t PCI bus(es) and devices /proc/bus/pci/ lsusb -v USB bus(es) and attached devices /proc/bus/usb/ scsi_info /dev/sda SCSI device info /proc/scsi/scsi [pc]cardctl status|ident|info|eject|insert ------------------------------------- netstat -l listening services/daemons -t TCP only -p PID --inet not Unix domain sockets -a all nmap localhost ------------------------------------- ps mix of dash options and no-dash options ps x mine not associated with a this terminal ps --no-heading ps ax all processes in system ps -u username Output formats: u e l f -f pstree -phc tree of processes ------------------------------------- find -name '*.gif' -exec ls -l '{}' \; #long listing of all .gif files find -name '*.o' -exec rm '{}' \; #delete .o files find -size +1M -exec ls -l '{}' \; #long listing of files >1MB touch file update modification timestamp (or create empty file) expand f tabs to spaces ???? unexpand spaces to tabs hexdump | hd instead of od head tail -f watch file grow /var/log/messages cat tac /var/log/apache/access.log error.log rev nl file add line numbers. cat -n uniq -c like -u of sort. -c gives frequency count too. paste f1 f2 side-by-side paste split file split into 1000 line files xaa xab... -b 1m 1MB chunks pr file paginate, headers/footers for printing fmt -w 100 -s file reformat paragraphs break lines longer than 100, no refill paras cmp f1 f2 compare files. -s diff f1 f2 differences between two [versions of] files ------------------------------------- /etc/X11/xorg.conf /XF86Config xvidtune -show xlsfonts xfd -fn fontname ------------------------------------- if cmd1(s) then cmds2 else #optional cmds3 fi if cmd1 ;then cmds2 ;else cmds3 ;fi Execute the cmd1 command(s), if it (or the last one) is "successful" then execute the cmds2 commands, otherwise execute the cmds3 commands. "Success" is command-dependant: grep: finds the search, cmp: files are the same, if cmp -s f1 f2 ;then echo identical ;else echo different ;fi #-s no output if cmp -s f1 f2 ;then echo identical. deleting f1; rm f1 ;else echo different ;fi if grep -q word filename ;then echo yes ;else echo no ;fi #-q no output ------------------------------------- Numeric for loop: for ((i=1; i<=10; i++)) ;do echo $i ;done