Terminal Window Title does not update after exiting ssh

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Box293
Level 1
Level 1
Posts: 10
Joined: Mon May 12, 2014 5:39 pm

Terminal Window Title does not update after exiting ssh

Post by Box293 » Wed Dec 03, 2014 11:08 pm

I'm using Linux Mint 17 MATE.

I open a terminal.
The title bar text says "Terminal" (for the terminal window that is now open).
I ssh to another box
ssh root@xitest
The title of the terminal now says root@xitest:~

I exit the ssh session

Code: Select all

user@computer ~ $ ssh root@xitest
Last login: Thu Dec  4 13:55:46 2014 from computer
[root@xitest ~]# exit
logout
Connection to xitest closed.
user@computer ~ $ 
The title of the terminal window still says root@xitest:~
Selection_055.png

User avatar
xenopeek
Level 24
Level 24
Posts: 24133
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Terminal Window Title does not update after exiting ssh

Post by xenopeek » Thu Dec 04, 2014 5:50 pm

This is as expected. It's how you configured it, or perhaps better put how you didn't reconfigure it.

By default MATE terminal sets the initial title of the terminal to "Terminal". If a program sets the terminal title, it overwrites that. If you exit that program (ssh), but no other program sets the terminal title it doesn't magically reset--a program (or you) must change it for it to, ah, change :)

You can change the behavior of this in Edit > Profile Preferences, on the Title and Command tab. MATE terminal doesn't have much options; you can basically either let a command change the terminal title, or set it so it is always "Terminal".

You can also set the terminal title yourself, with this command:

Code: Select all

echo -ne "\033]0;exampletitle\007"
You can do some nice things with that if you set up your .bashrc file to run a command through the PROMPT_COMMAND variable to set the terminal title. For example, I have it configured so the terminal title is set to the current directory when no command is running and to the command string when a command is running.

Other terminals may have more options for this built in; for example KDE's Konsole terminal title behavior can be configured in much more detail without need to hack in .bashrc :wink:
Image

User avatar
martywd
Level 3
Level 3
Posts: 146
Joined: Sun May 08, 2011 10:35 am
Location: TX

Re: Terminal Window Title does not update after exiting ssh

Post by martywd » Thu Dec 04, 2014 10:36 pm

I ran into the same issue in Linux Mint MATE as far back as either LM15 or 16. Try adding the following code into either your '~/.bashrc' or the global '/etc/bash.bashrc' file:

Code: Select all


# If this is an xterm set the title to user@host:dir
 case "$TERM" in
 xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
 *)
    ;;
 esac

Save the changes, logout of X and log back in.
.

ams001
Level 1
Level 1
Posts: 3
Joined: Tue Jun 09, 2015 4:30 am

Re: Terminal Window Title does not update after exiting ssh

Post by ams001 » Tue Jun 09, 2015 4:35 am

Thanks martywd. That did the trick for me.

Post Reply

Return to “Software & Applications”