1

I work with several ubuntu servers and I connect to them from my mac by terminal (ssh). On normal workdays I have up to 10 terminal windows running to distinct servers. The problem is that I easily loose the overview and everytime I go into a terminal window I have to make sure to be on the right server, because all servers have nearly the same name and that is the problem.

This is what my command line looks like alex@h2530242:/$

other servers have nearly the same number and this is confusing like hell. Can I change the display? Maybe to

alex@myOwnServerName:/$  mkdir hello

So the best thing would be that I can set my SSH to display another name and I would not need to change computer name of the remote server.

1 Answers1

1

If you're just looking to change the display, you could change the PS1 value of your .profile ,assuming you're using bash...

HOSTDISPLAY=server01

export PS1="[${LOGNAME}@${HOSTDISPLAY} \${PWD}]"
  • This helped me alot, thanks! On every remote server I added your code on the end of the file ~/.bashrc (for my user 'alex' and even for the root user, for root the file is in the /root/ folder). Now when I log into the server with ssh my terminal is magically changing ! And I added colors... ;) My new prompt is: PS1='\[\033[1;73m\][\date +%H:%M:%S`][\033[1;36m][[\033[1;34m]\u[\033[1;33m]@[\033[1;32m]\h:[\033[1;35m]\w[\033[1;36m]][\033[1;31m]\$[\033[0m] ${HOSTDISPLAY}> '` It's a color bomb! ;) – Lean-Juc Dicarp Apr 01 '16 at 21:40