tmux Command: Tutorial & Examples
Run multiple "tabs" in one terminal session
tmux is a terminal multiplexer for Linux, similar to
screen. It allows you to create and manage multiple terminal sessions within a single terminal window
or console, and enables you to run multiple programs or processes in the background while you are logged in to the terminal.
Here are some common uses of the
Start a new terminal session: To start a new terminal session within a
tmuxwindow, you can use the
tmuxcommand followed by any command you want to run. For example:
This will open a new
tmuxwindow and run the
lscommand in it.
Detach from a terminal session: To detach from a terminal session and leave it running in the background, you can use the
Ctrl-b dkey combination. This will close the terminal window and return you to the command prompt, but the program or process you were running within the
tmuxwindow will continue to run in the background.
List available terminal sessions: To list all the available terminal sessions that you have running in
tmux, you can use the
tmux -lscommand. This will display a list of all the
tmuxwindows you have open, along with their session names and process IDs.
Reattach to a terminal session: To reattach to a terminal session that you previously detached from, you can use the
tmux attachcommand followed by the session name or process ID of the session you want to reattach to. For example:
tmux attach -t 12345
This will reattach to the terminal session with the process ID 12345.
There are many more options and features available with the
tmux command. You can use the
man tmux command to view the full manual for
tmux and learn more about how to use
Info: Here at CleverUptime we use
tmux a lot to run programs in the background even when we're disconnected from the server. It's also very helpful when your
internet connection is not very stable. When the connection breaks up you can log in again and continue where you left off. As an alternative, we also
screen but most of us prefer