Today's column is a grab bag of useful aliases that will save you some precious typing time. The sysadmins I know like to type as few characters as possible, so many of these are especially terse.
The first alias serves as a command "preface". That is, type the alias, follow it with an argument and you're good to go. It runs the ps command, sends the output to grep and expects you to provide the string to be used in the search. Thus, we call it "psg" for "ps" and "grep".
alias psg="ps -ef ¦ grep "
You can use this alias to search for applications and users. You might type "psg httpd" to view apache or "psg squarepants" to list all of Bob's jobs.
Another alias of the preface variety is this find command. Instead of trying to teach your users which argument comes where in the find command, you can have them type just ff followed by the name (or regular expression) for the file(s) they're looking for.
alias ff="find . -type f -name "
The next alias lists all files with their inode numbers. Another two-letter alias.
alias li="ls -li | sort -n | more"
This alias lists your files a screen at a time. You get a long listing and include "hidden" files by typing just two characters.
alias lm="ls -al | more"
The usage alias goes a little further than the findbig alias presented in an earlier column (found the five largest files). It lists the sizes in blocks of all your files and sorts them in size order.
alias usage="du -skc * | sort -rn | more"
If you find that you're frequently listing the contents of files in some particular directory, you can assign an alias with an obvious name to do the job. This one shows the files with the most recently updated documents last in the list (so they'll be the ones you'll notice right away).
alias html="ls -ltr /usr/local/apache/htdocs"
If you turn forwarding on and off fairly routinely, you can create aliases that move your .forward file to an inactive status (by changing its name) and then back again.
alias forward='mv forward .forward' alias stayput='mv .forward forward'
Here's a nice alias for lisitng directories only:
alias lsDir='ls -d */'
And, finally, here's an alias to greet you when you're working late and feeling
alias hello="echo Hello, $USER. What are you doing here on a `date +%A`?"