Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to create command aliases in linux? For example, I'd like to make alias for ssh root@host

Thank you?

share|improve this question
As another option you may want to man ssh_config and consider creating a .ssh/config. Using this file you can set default login users for particular hosts. For example if you have a lot of switches that use an 'admin' user, you might add an entry for those so you can just ssh switch1 without having to remember 'admin@'. – Kyle Smith Dec 18 '10 at 23:40
up vote 5 down vote accepted

Which shell?

Assuming bash, put this kind of thing in your .bashrc:

alias srhost="ssh root@host"
share|improve this answer

I like to create a .bash_aliases file for portability between my systems I use. add this to your .bashrc

if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi

you can then add aliases to this file such as

alias psg='ps -auxww|grep'

also after adding a alias you will need to exit/open your terminal so the changes will take affect.

OR try

source ~/.bashrc

share|improve this answer

Only for your user, edit your .bashrc

alias srhost="ssh root@host"

To add Alias

alias newcommand="yourcommand -arguments"

To remove Alias

unalias newcommand

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.