Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

It's not a common scenario, but I find myself accidentally inserting commands into the wrong terminal. I haven't damaged anything important yet; So before I do, what are some of the best ways to differentiate between a local and remote terminal session?

share|improve this question

3 Answers 3

up vote 8 down vote accepted

The two main ways to do this are to change your PS1 variable so it contains the host name, and to use different colour schemes on your terminal app for different hosts. You could also use separate colour schemes for root shells.

share|improve this answer
Changing the color of the prompt is great. My prompt is user@host, where normal users are green, and root is red. Host is a different color for each host, so it's easier to tell at a glance which system I'm in and if I'm root. –  Mnebuerquo May 13 '10 at 18:45

I always have user and host name in my shell prompt

share|improve this answer

Just to follow up on the previous answers, edit your $HOME/.bash_profile to set PS1 upon login.

PS1='\h [!]: '

The above setting will display the host name of the system plus the history number of the current command.

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.