Search code examples
bashshellubuntutmux

How to completely close terminal (Ubuntu bash) from TMUX session?


Can someone please help as how can I close the bash terminal completely from inside of TMUX session (closing TMUX session as well)?

Below code is from my .bashrc where TMUX session starts as soon as terminal launches

if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach -t default -c "$HOME" || tmux new -s default -c "$HOME" fi

Thanks!


Solution

  • You can use tmux detach -P to both detach and send HUP to the parent process, which should make it exit as well.