DEV Community

Zen Oh
Zen Oh

Posted on

tmux Cheatsheet

When you SSH into a server, sometimes you need to run a script that takes a long time to execute. You have to keep the connection open while the script is running—otherwise, it might fail (for example, if your internet connection gets disconnected).

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (so they keep running in the background), and reattach them later.

Here are the common commands I usually use with tmux:

New Session

tmux new -s s1
Enter fullscreen mode Exit fullscreen mode

Detatch Session

Ctrl + b then d

List Session

tmux ls
Enter fullscreen mode Exit fullscreen mode

Attach Session

tmux attach -t s1
Enter fullscreen mode Exit fullscreen mode

Kill Session

tmux kill-session -t s1
Enter fullscreen mode Exit fullscreen mode

Top comments (0)