These are some simple things, don't expect anything fancy. Also, realize that most of these things can be done multiple ways and with multiple languages. Sometimes to achieve the effect you desire you'll need to combine them or add extra code.

Simple command line tips

[unix]$ for i in `ls *mp3`; do cp $i $i.bak; done
[unix]$ ls *mp3 | while read i; do cp "$i" "$i with more spaces"; done

[unix]$ echo filename | sed 's/file/another/'

[unix]$ sed -e 's/oldtext/newtext/' -i file1 file2 file3 ...

[unix]$ sed -e '/pattern/ d' -i file1 file2 file3 ...

[unix]$ echo FilENamE | tr A-Z a-z

[unix]$ "ls" | while read name; do mv "$name" "`echo $name | tr A-Z a-z`"; done

[unix]$ man man | col -b

[linux]$ netstat -apne --inet
[freebsd]$ sockstat

[linux]$ lsof
[freebsd]$ fstat

[unix]$ host 10.0.0.0
[unix]$ dig -x 10.0.0.0

[unix]$ whois -h whois.arin.net 10.0.0.0

[unix]$ dig mx some.domain.name.net

[linux]$ touch logfile-`date -dyesterday '+%Y-%m-%d'`
[freebsd]$ touch logfile-`date -v-1d '+%Y-%m-%d'`

Commands you should know

You should know, or at least be aware of all these commands. You don't need to memorize their usage, you can always read the man pages.

Network tools

Other programs

NKB: Unix Tips (last edited 2006-05-01 01:25:48 by IgnacioSolis)