Feature Request - see the name of the server taken in ssh in the name tab #2531

Closed
opened 2026-01-30 22:57:35 +00:00 by claunia · 4 comments
Owner

Originally created by @TheMMcOfficial on GitHub (Jul 3, 2019).

Summary of the new feature/enhancement

Can we get the name of the server in the tab name? For the moment it's written "OpenSSH SSH client".

Proposed technical implementation details (optional)

Get the name for the server in the tab name when we type "ssh user@SERVER" in the new terminal. Maybe we can also have a place to save ssh setting to have quick access to certain servers.

Originally created by @TheMMcOfficial on GitHub (Jul 3, 2019). # Summary of the new feature/enhancement Can we get the name of the server in the tab name? For the moment it's written "OpenSSH SSH client". # Proposed technical implementation details (optional) Get the name for the server in the tab name when we type "ssh user@SERVER" in the new terminal. Maybe we can also have a place to save ssh setting to have quick access to certain servers.
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 3, 2019):

The shell on the other end is perfectly capable of reporting any information it wants to. The default configuration in Ubuntu, as an example, sets the title to user@server:directory -- all without the terminal having to do anything.

It's 1000x better to have the remote shell report this information, because if the local terminal has to do it it is just a guess and likely to be wrong.

If your remote shell is bash, check this out. If it's powershell, use $Host.UI.RawUI.WindowTitle

This is what it looks like for me:

image

@DHowett-MSFT commented on GitHub (Jul 3, 2019): The shell on the other end is perfectly capable of reporting any information it wants to. The default configuration in Ubuntu, as an example, sets the title to `user@server:directory` -- all without the terminal having to do anything. It's 1000x better to have the remote shell report this information, because if the local terminal has to do it it is _just a guess_ and _likely to be wrong._ If your remote shell is bash, [check this out](https://superuser.com/questions/84710/window-title-in-bash). If it's powershell, use `$Host.UI.RawUI.WindowTitle` This is what it looks like for me: ![image](https://user-images.githubusercontent.com/14316954/60612850-8556a900-9d7e-11e9-90d6-8bdbe8920b8b.png)
Author
Owner

@TheMMcOfficial commented on GitHub (Jul 3, 2019):

Thanks for your answer @DHowett-MSFT. Maybe I wasn't clear... But in Powershell or in CMD the tab name is "OpenSSH SSH client"... I tried an SSH connection on multiple servers including Ubuntu, Sles...

And I can't do "$Host.UI.RawUI.WindowTitle" when I'm logged in in SSH.

image

@TheMMcOfficial commented on GitHub (Jul 3, 2019): Thanks for your answer @DHowett-MSFT. Maybe I wasn't clear... But in Powershell or in CMD the tab name is "OpenSSH SSH client"... I tried an SSH connection on multiple servers including Ubuntu, Sles... And I can't do "$Host.UI.RawUI.WindowTitle" when I'm logged in in SSH. ![image](https://user-images.githubusercontent.com/34872211/60616050-99aa9e00-9d9e-11e9-9c07-7533c626c44f.png)
Author
Owner

@DHowett-MSFT commented on GitHub (Jul 3, 2019):

I may not have been clear either. When you are using SSH, you are likely running a shell on a remote machine. That shell can set the title to whatever it wants. There is a standard way for a shell to set a title. Your remote shells are not doing that. This is a configuration issue on your remote shell on the receiving end of the SSH connection. 😄

@DHowett-MSFT commented on GitHub (Jul 3, 2019): I may not have been clear either. *When you are using SSH,* you are likely running a shell on a remote machine. **That shell** can set the title to whatever it wants. There is a standard way for a shell to set a title. Your remote shells are _not_ doing that. This is a configuration issue on your remote shell on the receiving end of the SSH connection. :smile:
Author
Owner

@Sky-Walkrr commented on GitHub (Sep 17, 2019):

For those who comes after looking for setting title bar to ssh server name, here I provide a way (has tested on my remote server which runs a Cent OS 7 with bash shell):

  1. Edit the .bashrc file on your remote server machine, add lines below:
function title {
   PROMPT_COMMAND="echo -ne \"\033]0;$1 \007\""
}
title "$USER@$HOSTNAME"
  1. Save the changes and after next login, you should see the user@hostname on the Windows Terminal tab correctly.

Give it a try.

@Sky-Walkrr commented on GitHub (Sep 17, 2019): For those who comes after looking for setting title bar to ssh server name, here I provide a way (has tested on my remote server which runs a Cent OS 7 with bash shell): 1. Edit the `.bashrc` file on your remote server machine, add lines below: ```bash function title { PROMPT_COMMAND="echo -ne \"\033]0;$1 \007\"" } title "$USER@$HOSTNAME" ``` 2. Save the changes and after next login, you should see the user@hostname on the Windows Terminal tab correctly. Give it a try.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#2531