Tab title not updating after closing ssh connection #15151

Closed
opened 2026-01-31 04:29:56 +00:00 by claunia · 3 comments
Owner

Originally created by @MrEmanuel on GitHub (Sep 9, 2021).

Windows Terminal version (or Windows build number)

1.9.1942.0

Other Software

WSL 2
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020

Steps to reproduce

  1. Open a new tab or instance of windows terminal. Notice the tab says "Ubuntu" (I'm using Ubuntu with WSL2)
  2. ssh to a remote machine
    ssh my_user@machine_ip_address
  3. Notice the tab title updates to "my_user@machine_ip_address"
  4. Exit ssh
    ctrl-d
  5. Notice the tab title is still displaying the remote machine address. "my_user@machine_ip_address"

Expected Behavior

Expected behavior is that the tab title should update when closing an ssh tunnel to a remote machine.

Actual Behavior

The tab title stays locked as the remote machine address, i.e my_user@machine_ip_address.

Originally created by @MrEmanuel on GitHub (Sep 9, 2021). ### Windows Terminal version (or Windows build number) 1.9.1942.0 ### Other Software WSL 2 OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020 ### Steps to reproduce 1. Open a new tab or instance of windows terminal. Notice the tab says "Ubuntu" (I'm using Ubuntu with WSL2) 2. ssh to a remote machine `ssh my_user@machine_ip_address` 3. Notice the tab title updates to "my_user@machine_ip_address" 4. Exit ssh `ctrl-d` 5. Notice the tab title is still displaying the remote machine address. "my_user@machine_ip_address" ### Expected Behavior Expected behavior is that the tab title should update when closing an ssh tunnel to a remote machine. ### Actual Behavior The tab title stays locked as the remote machine address, i.e `my_user@machine_ip_address`.
Author
Owner

@MrEmanuel commented on GitHub (Sep 9, 2021):

I almost had a heart attack after (correctly) removing a database on my local machine and looking at the Windows Terminal tab (erroneously) telling me I'm still ssh'ed in to the production machine.

@MrEmanuel commented on GitHub (Sep 9, 2021): I almost had a heart attack after (correctly) removing a database on my local machine and looking at the Windows Terminal tab (erroneously) telling me I'm still ssh'ed in to the production machine.
Author
Owner

@zadjii-msft commented on GitHub (Sep 9, 2021):

Open a new tab or instance of windows terminal. Notice the tab says "Ubuntu" (I'm using Ubuntu with WSL2)

That would seem to suggest that your local shell in WSL isn't configured to set the tab title. What shell are you using in WSL locally? bash, zsh, fish?

I know in the stock .bashrc, there's the following snippet to set the tab title:

# 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

So if you've modified your PS1 at all, that might not be present anymore.

@zadjii-msft commented on GitHub (Sep 9, 2021): > Open a new tab or instance of windows terminal. Notice the tab says "Ubuntu" (I'm using Ubuntu with WSL2) That would seem to suggest that your local shell in WSL isn't configured to set the tab title. What shell are you using in WSL locally? `bash`, `zsh`, `fish`? I know in the stock `.bashrc`, there's the following snippet to set the tab title: ```bash # 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 ``` So if you've modified your PS1 at all, that might not be present anymore.
Author
Owner

@ghost commented on GitHub (Sep 13, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Sep 13, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15151