Methods of payment Abuse

Tmux command syntax and options

27.05.2023, 18:21

In the last article, we looked at what Tmux is. Briefly, Terminal Multiplexer is a command-line utility for managing multiple terminals within a single window. It allows users to run multiple programs in a single terminal, split a terminal window into multiple panes, and group multiple panes in a single window.

Also tmux allows the user to save terminal sessions and resume them at any time. Tmux is very useful for managing remote servers and for creating more efficient multitasking environments in OS Linux. In this article, let's take a look at the syntax and some of the tool's options (not all of them, the most popular ones).

Tmux syntax

The Tmux command has the following syntax:

tmux [options] [command]

Tmux options

Some of the most commonly used options of the Tmux command are:

  1. -c <path> - specifies the path to the configuration file.
  2. -L <name> - specifies the name of the socket.
  3. -f < path> - specifies the path to the socket.
  4. -S <name> - specifies the name of the session.

Tmux Commands

The most commonly used Tmux commands are:

  1. new-session- creates a new Tmux session.
  2. list-sessions-displays alist of current sessions.
  3. attach-session- connects to the specified session.
  4. detach-session- disconnects the current session from the shell.
  5. switch- switches to another panel or window.
  6. kill-server- stops all running sessions;
  7. kill-session- terminates the session passed in the -t parameter;
  8. list-clients- see the clients connected to the -t session;
  9. list-sessions(ls)- display alist of all running sessions;
  10. rename-session-rename a session, pass the session ID and a new name.

Additional options and commands can be found by calling the Tmux help with the command

man tmux

Or:

tmux -h

Next we will tell you how to use the command in practice.

Using Tmux

To create a new session it is enough to execute the command without parameters:

tmux

Tmux command syntax and options

You can also create a session with the new-session command and give it a convenient name:

tmux new-session -s "name"

Now you can use Tmux and create sessions with the command.