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.

  • 4
    Possible duplicate of How can I shorten my command line (bash) prompt?. Not exactly the same question, but it should help you. – Jakuje Apr 1 '16 at 20:30
  • @guntbert I've skipped past the part that says OP is connecting to Ubuntu servers. I do apologize. – Sergiy Kolodyazhnyy Apr 1 '16 at 21:44
  • @serg: no problem, I have to admit that I thought I would need to change these bash settings on my mac, didn't know that the bash settings are coming from the server I am connected to. (so I actually should ask on a mac site, but I don't know any). But I'm happy that I posted it finally here, got the help I was seeking. – Lumpy Apr 1 '16 at 21:50

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


export PS1="[${LOGNAME}@${HOSTDISPLAY} \${PWD}]"
|improve this answer|||||
  • 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! ;) – Lumpy Apr 1 '16 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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