Setting Aliases with alias

Aliases are nicknames of sorts that you use to enter commands more easily. For example, if you frequently use the command mail -s “Lunch today?” deb < .signature, you could set an alias for this command and call it lunch. Then, in the future, all you have to do is type in lunch, and the result is the same as if you typed in the longer command.

To set an alias with alias:

1.
Choose the appropriate file to edit, depending on which shell you’re using.
  • zsh users should use ~/.zshrc

  • bash users should use ~/.bashrc

  • ksh users should use ~/.profile

  • csh users should use ~/.cshrc

If you don’t have the appropriate file, you’re welcome to use a different configuration file. Many people store all their aliases in a separate .alias ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.