The contents on this site are being moved to Highlander Nexus

CreateAliases

From Linux and MacOSX Wiki
Jump to: navigation, search

Creating Aliases


Purpose:This documentation will help you create Aliases for use on your Linux system.Aliases are names or keywords assigned to commands that launch operations.


To set an alias, we must edit the alias file. If you’re using RHEL your alias file is located in ~/.aliases. If you’re using a Debian system your alias file is located in ~/.bash_aliases by default. It is important to note that ~/. signifies the user's home directory.

For example, the full path of the alias file on a Debian system would be: /home/USER/.bash_aliases

  • To edit the alias file run:
  • vi ~/.aliasesFor RHEL


    Or

    vi ~/.bash_aliasessFor Debian systems


    Creating an alias results in the following:

    alias name=’command’
  • For example, if we wanted to create an alias called browser that launched Google Chrome, we would add the following alias to the alias file:

  • alias browser=’google-chrome’

    Then source the alias file after saving the new addition in order to use it:

    source ~/.aliases

    Or

    source ~/.bash_aliases

    When we type the alias browser into our terminal it will then launch the Google Chrome browser.

  • To list available aliases enter:

  • alias
  • Here are some aliases that may be helpful:

  • alias weather='curl wttr.in'

    alias afs =’ssh ucid@afs1.njit.edu’

    alias reboot=’sudo reboot’