Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

One of the my main difficulties when I am administrating remote servers, its to identify the server that I'm working, once the shell is very similar between them (in fact, only the user is different in most cases).

I would like to know of is possible to create custom shells considering the remove server which I am connected.

Thanks for the help, Best regards!

share|improve this question

If you mean custom shell prompt, take a look at the PS1 variable (man bash, search for PS1). It has lots of options. Here is a full guide, but for a start try

export PS1=\u@\H \$>

which gives you a prompt like $> _
share|improve this answer
Instead of just the prompt, I would like to customize the entire shell window (different background, watermarks, etc.) according the remote server. – Rui Gonçalves Nov 24 '10 at 15:18
@Rui Gonçalves, well in that case you should definitively look into "screen" which is highly customizable in both look and functionalities. – Mr Shunz Nov 24 '10 at 15:21
byobu is pretty good too, and comes with ubuntu as standard, has colour highlighting, and gives a bar at the bottom of the screen showing hostname. – Sirex Nov 24 '10 at 15:30
And can it be automatically configure according the remote server? – Rui Gonçalves Nov 24 '10 at 15:32
@Rui Gonçalves by default byobu (which is a set of customizations for screen) gives lots of information. If you need more to differentiate servers (like colors and such) you have to tweak the config per-server yourself. – Mr Shunz Nov 24 '10 at 16:32

Are you leveraging the PS1 variable for customization? Not all versions of all shells handle the variable in the same manner, but most will accept a \h for hostname, \u for username, and \w for the current working directory.

Please see this page for additional options, examples, and suggestions.

share|improve this answer

regarding ps1 tweaks, this is what i use in my .bashrc

if [ $userName == "root" ]
    PS1='\[\e[0;31m\]\u\[\e[0m\]@\[\e[0;35m\]\h\[\e[0m\][$?]\[\e[0;31m\][\W]\[\e[0m\]\[\e[0;31m\]\$\[\e[0m\]: '
    PS1='\[\e[0;32m\]\u\[\e[0m\]@\[\e[0;35m\]\h\[\e[0m\][$?]\[\e[0;31m\][\W]\[\e[0m\]\[\e[0;32m\]\$\[\e[0m\]: '

It'll give the username as red when root, green otherwise. and has the hostname and return code of last command. - might help you.

Also, try byobu (as suggested in comment to mrshunz)

share|improve this answer

Just use a unique and self-explanatory names for the hostname of your remote servers. Then, you will be able to know on which server you are working!

You can change the hostname from /etc/hostname. Restart the service /etc/init.d/hostname restart. Also, don't forget to update the /etc/hosts file.

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.