Tmux : Top Most Important Tmux Commands

0
715

tmux is a terminal multiplexer that allows you to run multiple terminal sessions within a single terminal window or remote terminal session. Here is a cheat sheet of some common tmux commands:

tmux                 # Start a new tmux session
tmux attach          # Attach to an existing tmux session
tmux detach          # Detach from the current tmux session
tmux kill-session    # Kill the current tmux session

# Navigation
CTRL + b, c         # Create a new window
CTRL + b, w         # List all windows
CTRL + b, n         # Move to the next window
CTRL + b, p         # Move to the previous window
CTRL + b, &         # Kill the current window
CTRL + b, ,         # Rename the current window
CTRL + b, .         # Move the current window

# Panes
CTRL + b, "         # Split the window vertically
CTRL + b, %         # Split the window horizontally
CTRL + b, o         # Focus on the next pane
CTRL + b, q         # Show pane numbers
CTRL + b, x         # Kill the current pane

# Miscellaneous
CTRL + b, t         # Show the current time
CTRL + b, ?         # Show a list of all keybindings
CTRL + b, d         # Detach from the current session without killing it
CTRL + b, [         # Enter copy modeCTRL + b, ]         # Paste from the clipboard

It is useful for a number of purposes, including:

  • Running multiple programs concurrently: With tmux, you can run multiple programs in separate terminal windows (called “panes”) within the same session. This can be helpful if you need to monitor the output of multiple programs at the same time, or if you want to keep a program running in the background while you work on something else.
  • Persistence: tmux allows you to keep programs running even if you close the terminal window or disconnect from the terminal session. This can be helpful if you are running a long-running process or if you want to keep a program running in the background while you are away from your computer.
  • Remote terminal access: tmux can be used to access a terminal session remotely, allowing you to work on a remote machine as if you were sitting in front of it. This can be useful if you need to work on a remote machine but do not have a graphical interface available, or if you want to access a terminal session from multiple locations.
  • Window management: tmux allows you to create multiple windows within a single session, making it easy to switch between different programs or tasks. Each window can contain multiple panes, allowing you to split the terminal screen into multiple sections for greater productivity.

There are a number of alternatives to tmux that offer similar functionality:

  1. GNU Screen: Screen is a terminal multiplexer that was developed before tmux and has a similar feature set. It is pre-installed on many Linux systems and is a popular choice for terminal multiplexing.
  2. Byobu: Byobu is a wrapper around GNU Screen that adds additional features, such as the ability to display system status information and notifications within the terminal. It is available for both Linux and macOS.
  3. Terminator: Terminator is a terminal emulator that includes built-in support for terminal multiplexing. It is available for Linux and offers a number of customization options.
  4. Guake: Guake is a drop-down terminal emulator for Linux that includes support for terminal multiplexing. It can be accessed by pressing a hotkey, allowing you to quickly switch between different terminal sessions.
  5. Konsole: Konsole is the default terminal emulator for the KDE desktop environment and includes support for terminal multiplexing. It is available for Linux and offers a number of customization options.

Here are the four most common tmux commands:

  1. tmux: This command is used to start a new tmux session. If you are already in a tmux session, it will create a new session within the current session.
  2. tmux attach: This command is used to attach to an existing tmux session. If you have multiple tmux sessions running, you can use this command to switch between them.
  3. tmux detach: This command is used to detach from the current tmux session. The session will continue running in the background, allowing you to disconnect from the terminal or close the terminal window without killing the session.
  4. tmux kill-session: This command is used to kill the current tmux session. All programs running within the session will be terminated, and the session will be closed.

Note: These commands assume that the default tmux prefix (CTRL + b) is being used. If you have changed the prefix in your tmux.conf configuration file, you will need to use the appropriate prefix in place of CTRL + b.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.