Sunday, February 25, 2007

Create a Command Alias in .cshrc

I like to create shortcuts. One of my favorite commands is using ls accompanied with the -ltr options. These options display a long list, time sorted, and in reverse order. It’s a good idea to alias the rm for interactive mode, too.

# csh
# vi $HOME/.cshrc
alias ls 'ls -ltr'
alias lp 'lp -d not_primary_printer'
alias rm 'rm -i'
:wq! (saves and quits vi)

# ls
-rwxrw--r-- 1 esofthub mygroup 2345 Feb 21 01:34 esofthub
-rw-rw--r-- 1 esofthub mygroup 8078 Feb 21 01:35 esofthub1
# lp esofthub1

Note: You can unalias the command, too.
# unalias ls
# unalias rm

No comments: