Bash Aliases serve two functions as as far as I can tell: 1) too long to type accurately or quickly, and 2) too long to remember.

To figure out what you should alias under condition 1, run

cat ~/.bash_history | sort | uniq -c | sort -rn | less
and look at the high counts. Can you make them smaller? Like if you always type 'ps fax' why not alias ps or perhaps change the default?

For condition 2, I just stick them in a Makefile in my homedir, so once a year, I can type "make web<TAB>" and get a list of targets, one of which I wrote to partially automate the setup of a secure cert under apache2. Pretty much anything sysadmin complex gets tossed in there as a howto that i can then later work with, or just run.

Thinking further about shell history, it's also useful to skim it directly and see what commands typically clump together. I noticed that I always run an ls after a file operation (chmod, chown, etc), and after cd'ing to a new directory. So I added the following to my bashrc:

# verify file changes by printing out the effects file_change() { cmd=$1 shift ${cmd} $@ for f in $@ ; do if [ -f "${f}" ]; then ls -alh ${f} fi done } mv() { file_change /bin/mv $@ } chmod() { file_change /bin/chmod $@ } chown() { file_change /bin/chown $@ } cd() { builtin cd $@ ls -C | head }

I should do more like that. Pretty cool. I have a hand full of aliases and functions in my bashrc that I version control and then get out on a new box (owned by me, I don't usually check it out on customer machines). Since I use apt on Ubuntu, I functionalized all the typical commands, like 'apt-cache search' as 'acs', and 'apt-get install' as 'agi'. Etc. I do the same with gem, and it's associated helpers.