6

Using the tmux command kill-server one can immediately shut down the tmux server and close all open tmux windows.
How does this affect the processes still running inside the various tmux windows? Will they shut down gracefully or just be forced to quit, leaving open filelocks etc.?

To use the command put the following line in your .tmux.conf:
bind k confirm kill-server

2
  • Hi and welcome to UL.se. The first result googling for tmux kill-server yields an answer on askubuntu which states as first sentence: You can use tmux kill-server to cleanly and gracefully kill all tmux open sessions (and server). Commented Mar 22, 2019 at 14:31
  • 1
    It refers to the sessions and server. I was not sure if that includes the programs running inside those sessions. Commented Mar 22, 2019 at 14:36

1 Answer 1

6

All processes inside tmux will be sent SIGHUP, just as if you had used kill-pane/kill-window/kill-session. What the program chooses to do with the signal depends, most will shutdown cleanly.

Note that "tmux kill-server" just causes tmux to send itself SIGTERM, so it is the same as killing it with pkill or kill.

2
  • What will happen if the inside processes ignore SIGHUP? Commented Jul 17, 2020 at 12:54
  • They will stay running (unless they die for some other reason, for example when their stdin or stdout is closed). Commented Jul 17, 2020 at 14:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.