Categories
Linux

Linux: using tmux to start server processes

If you want to start a process or command on a linux server and want to return later to check if it ran ok, or if it is still running, then the tmux tool is very handy.

Tmux can do many more things (like split a terminal window in multiple panes), but that is outside the scope of this article.

To start a new session on your server (once you are connected to the server with ssh), type:

tmux new -s mysession

where ‘mysession’ is the name you want to use

Now start whatever command you want.

If you want to leave your session, but keep everything running so you can check back at a later time, press Ctrl-b d.

To list all detached sessions, use the following command:

tmux ls

No you can reattach to a session using the following command:

tmux attach -t mysession