InMotion Hosting Support Center

When working with SSH and the command line interface, you may want to begin trimming down the number of keys you hit by creating aliases for the commands you use most often. This can help you move along faster when working on your site. This article goes over the alias command and how to use it.

Command: alias
Synopsis: alias [name[=value] ...]

Examples

Alias for the clear command

In this example, we create an alias for the 'clear' command. We shorten it to simply 'c'.

# alias c='clear'
    

Aliases for various cd commands

For this example, we will make some shorter cd commands for going up one, two, or three levels.

# alias ..='cd ..'
# alias ...='cd ../..'
# alias ....='cd ../../..'
    

Aliases for common mistakes

If you have a habit of not leaving a space in between the 'cd'' and the '..' portion of the 'cd ..' command, you can create an alias for that as well.

# alias cd..='cd ..'
    

Listing the aliases

If you want to have the entire list of aliases displayed, use the following version of the alias command.

# alias -p
alias attrib='chmod'
alias chdir='cd'
alias copy='cp'
alias cp='cp -i'
alias d='dir'
alias del='rm'
alias deltree='rm -r'
    

Removing an alias

The following couple of examples demonstrate how to remove aliases with the 'unalias' command.

Removing a single alias

This example shows how to remove a single alias. In the example below we are removing the 'c' alias we created above.'

# unalias c
    

Remove all aliases

If you wish to clear your alias list, use the following command. Do note that it deletes ALL aliases.

# unalias -a
    

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

   
Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!