DEV Community

Cover image for How to use tmux
Israel-Lopes
Israel-Lopes

Posted on • Updated on

How to use tmux

tmux is a terminal multiplexer that allows you to split a single terminal window into multiple areas and run multiple commands in those areas. It's useful for those who need to run multiple commands or applications at the same time in the terminal, as it allows you to organize and switch between them easily.

To install tmux, you first need to check if the package is available in your package manager. On Ubuntu, for example, you can use the command sudo apt-get install tmux to install it.

Once installed, you can start it by typing tmux in the terminal. This will create a new tmux session, in which you can split the terminal window into multiple areas.

To split the window horizontally, press Ctrl-b followed by ". To split the window vertically, press Ctrl-b followed by %. You can switch between the areas using the arrow keys on your keyboard.

There are many other options and features available in tmux. For more information, see the official tmux documentation on their website.

The main keys for tmux

  • Ctrl-b: The prefix key that must be pressed before other keys to send commands to tmux.
  • ": Splits the terminal window horizontally.
  • %: Splits the terminal window vertically.
  • Arrow keys: Allow you to navigate between the split areas of the terminal window.
  • ?: Shows the list of tmux commands.

In addition to these basic keys, tmux has many other commands and options that can be found in the official tmux documentation.

You can configure tmux by editing the tmux configuration file, which is usually called .tmux.conf and is stored in the user's home directory.

To edit the configuration file, you can use a text editor such as nano or vim. For example, to edit the file with nano, you can use the command nano ~/.tmux.conf.

Once in the configuration file, you can add options and commands to customize tmux according to your needs. For example, you can change the tmux shortcut keys, change the color of the windows, or add new commands.

The tmux documentation contains more information about the available configuration options and how to use them. It is recommended that you consult the documentation for more details on how to configure tmux.

Some of the main advantages of using tmux

  • It allows you to split a single terminal window into multiple areas and run multiple commands or applications in those areas at the same time. This makes it easy to organize and manage multiple commands or applications in a single terminal.
  • It allows you to save and retrieve tmux sessions, which is useful when you need to continue working on a set of commands or applications at a later date.
  • It allows you to access tmux sessions from multiple devices, which is useful when you need to access the same set of commands or applications on different devices.
  • It has many configuration options and features that allow you to customize tmux according to your needs.

Texto alternativo da imagem

Top comments (0)