Just read
this entry about the 'whereis' command on Unix and it reminded me of another great shell tip for tcsh users (csh/tcsh on FreeBSD since they're the same thing!) - the shell can 'normalize' any command on the command line if you bind the normalize function to a keystroke - this allows you to easily see how a command would expand after it's executed. Somewhat esoteric without an example, but I use it so much I thought I'd post about it.
First off set a key binding for the normalize command - in the shell type in:
CODE:
bindkey "^W" normalize-command
or add it to ~/.cshrc to make it permanent. Obviously you can set it to whatever keybinding you want, I use ctrl-w.
Now type in any command that you'd use on the commandline and then whilst the cursor is at the end of the command, hit the keystroke you entered for the normalize command - in our case above, ctrl-w.
The command you entered should automatically get expanded to the absolute path of the command. For example if I type in:
CODE:
ls
and then hit 'ctrl-w' whilst the cursor is just after the 's', the result will look like:
CODE:
/bin/ls
Magic!
Like I say I use this function quite a lot on the commandline, particularly when I want to see how a command I enter will get expanded - the normalize function works on aliases as well as just plain commands, so it's quicker to type 'portupgrade^w' than to type in 'alias portupgrade' to see how I've got my portupgrade alias set up. It's also great for quickly editing system executables from the commandline without having to remember where the file/script is or cut/paste the results from 'whereis' or 'locate' etc.