Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
From the author of

A Final Warning

Aliases are very useful little things, but I hope that after this introduction, you find functions at least as interesting (and probably even more useful). A final caveat to both aliases and functions is that you should never replace a standard command with an alias or a function. It's too easy to really hurt yourself by trying to execute your alias when it doesn't exist. Imagine the difference between doing this:

$ alias rm='rm -i'
$ cd ~/scratch
$ rm *  # here the rm alias catches you and interactively
     # deletes the contents of your current directory

and then later in the same session doing this:

$ su -
# cd /tmp
# rm # here the rm alias no longer exists, and you whack
   # a bunch of stuff out of /tmp

Happy hacking!

  • + Share This
  • 🔖 Save To Your Account