Home Linux Shell
For loop, example renaming all files in current directory to .old

for i in `/bin/ls`; do mv $i $i.old ; done


Find and exec; example deleting all files with names ending in .old

find . -iname *.old -exec rm -i {} \; 


For loop with if's on command line, example finding files that are not on the system

for i in `cat myListe`; do if [[ ! -f $i ]]; then echo $i >> notfoundlist ;fi; done


Find dead symlinks

find . -type l ! -exec test -r {} \; -print


List all ipaddresses

ifconfig  | sed -n 's/.*dr:\(.*\) Bc.*/\1/p'