(Useful) Stupid Glob-pattern Tricks
The advantage of the directory stack over "cd -" is that the directory stack always remembers where you last were. "cd -" only remembers until you change directories again.
In tcsh (I don't know other shells), you can do directory stack substitution. =0 is current directory, =1 is one up, =2 is two up, and so on.
I also use bindkeys to bind Control-G to 'dirs -v' so I can look at the directory stack with ease, even in the middle of a command.
Personally, I think directory stack commands are the least-known, but most useful feature in tcsh.
alias myps 'ps auxww | grep $USER'
alias awkill 'awk '\''{print $2}'\'' | xargs kill'
Run "myps | grep firefox | awkill -9" to kill all firefox sessions.
alias pd 'pushd'
alias po 'popd'
alias dirs 'dirs -v'
Don't forget directory stack substitution (=1, =2, etc.)
alias aw 'awk '\''{print $'\!:1'}'\'''
Grab column 5 with "aw 5". (e.g. ls -l | aw 5)
If you use the shell a lot, I recommend you get familiar with grep, awk, sed, find and xargs. Here's a quick example that I just had to use today. I got a bunch of Windows ascii files mixed with a bunch of other files. I wanted to run dos2unix on only the Windows ascii files. And the files were spread across several directories.
find . -type f | xargs file | grep CRLF | aw 1 | sed 's/://' | xargs dos2unix
My knowledge of tcsh is what's been keeping me from switching to bash. I like to use popular standards, but I don't know how to do this stuff in bash. I learned the tcsh stuff when I actually had time to read shell man pages.
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn