Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

byobu renames windows in ssh session

Tags:

ssh

byobu

I connect to a remote computer with ssh and start a byobu session on the remote machine. Whenever I change the directory in a byobu window, the window gets renamed to username@remote-pc:~/.../.../.... When I rename the window using F8 the name persists until the next cd.

How can I prevent this?

like image 964
Jonas Avatar asked Dec 25 '22 22:12

Jonas


2 Answers

I had the same problem on Fedora.

In each bash session, PROMPT_COMMAND is set by default in /etc/bashrc to __vte_prompt_command

man bash says

PROMPT_COMMAND
If set, the value is executed as a command prior to issuing each primary prompt.

__vte_prompt_command is defined in /etc/profile.d/vte.sh

type __vte_prompt_command gives

__vte_prompt_command is a function
__vte_prompt_command () 
{ 
    local pwd='~';
    [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/};
    printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)"
}

to prevent this, you could add unset PROMPT_COMMAND after sourcing /etc/bashrc in your ~/.bashrc

You may also want to do this only inside a byobu session, you could test byobu environment variable for that (BYOBU_RUN_DIR?)

like image 147
FredG Avatar answered Jan 13 '23 12:01

FredG


This answer is for zsh users.

I've had this happen to me twice now with zsh. Frustrating. Posting here so I can search for the solution in the future (and hopefully help any other lost souls).

In ~/.zshrc you will find

# Uncomment the following line to disable auto-setting terminal title.                                                                                                          
# DISABLE_AUTO_TITLE="true"

Uncomment out DISABLE_AUTO_TITLE="true" so it looks like

# Uncomment the following line to disable auto-setting terminal title.                                                                                                          
DISABLE_AUTO_TITLE="true"

no worries, future me

like image 43
randbw Avatar answered Jan 13 '23 12:01

randbw