'How to kill a tmux pane along with the process running on it?

Let's say you run a command like grunt serve on a tmux pane, and you kill the pane on which the command is running. I found that the process is not killed:

ps aux | grep grunt

still shows that grunt is running even though the pane is gone. How do you kill a tmux pane along with the process(es)?



Solution 1:[1]

You may find the tmux-safekill plugin useful.

I wanted it to kill Ruby processes, so I had to fork the repo to add that functionality in, so I'm sure you could do the same for grunt processes if you don't get all the functionality you need from the repo directly.

Solution 2:[2]

To stop the program running you can close the pane by entering <C-B> x and then entering y.

Solution 3:[3]

Just do: <CTRL-B>:kill-pane

Solution 4:[4]

Use Ctrl+b¹, > to get a menu with this and other useful commands:

screenshot

This is what uses the Spotify plugin.

¹ Or the chosen tmux escape sequence.

Other notes and sources

tmux list-keys | grep display-menu  # More info about above command
curl cht.sh/tmux                    # Online cheatsheet

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paul Fioravanti
Solution 2
Solution 3 brotherol
Solution 4 Pablo Bianchi