How to fix terminal title after disconnecting from ssh
For some reason, ssh does not clean up after itself in terms of updating the terminal title when you disconnect.
Here is a simple solution, a combination of https://unix.stackexchange.com/a/341277/25975 and https://unix.stackexchange.com/a/28520/25975
Add the following functions into your ~/.bashrc
It will push the current title
and icon into a stack and pop it afterwards.
|
|
Restart bash / log out and back in, and it should work.
For security reasons, it is not possible to query the current title of the terminal. However, with the following command, you can push the current one on to a stack
|
|
The title can then be set to anything, by ssh for example. You can then pop that back from the stack using
|
|