Some Fedora users spend most or all their time at a[command line][4]terminal. The terminal gives you access to your whole system, as well as thousands of powerful utilities. However, it only shows you one command line session at a time by default. Even with a large terminal window, the entire window only shows one session. This wastes space, especially on large monitors and high resolution laptop screens. But what if you could break up that terminal into multiple sessions? This is precisely where_tmux_is handy — some say indispensable.
### Install and start _tmux_
The_tmux_utility gets its name from being a terminal muxer, or multiplexer. In other words, it can break your single terminal session into multiple sessions. It manages both_windows_and_panes_ :
* A_window_is a single view — that is, an assortment of things shown in your terminal.
* A_pane_is one part of that view, often a terminal session.
To get started, install the_tmux_utility on your system. You’ll need to have_sudo_setup for your user account ([check out this article][5]for instructions if needed).
```
sudo dnf -y install tmux
```
Run the utility to get started:
tmux
### The statusbar
At first, it might seem like nothing happens, other than a status bar that appears at the bottom of the terminal:
![Start of tmux session](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/Screenshot-from-2017-02-04-12-54-41.png)
The bottom bar shows you:
*_[0]_– You’re in the first session that was created by the_tmux_server. Numbering starts with 0\. The server tracks all sessions whether they’re still alive or not.
*_0:username@host:~_– Information about the first window of that session. Numbering starts with 0\. The terminal in the active pane of the window is owned by_username_at hostname_host_ . The current directory is_~_ (the home directory).
*_*_– Shows that you’re currently in this window.
*_“hostname”_– the hostname of the_tmux_server you’re using.
* Also, the date and time on that particular host is shown.
The information bar will change as you add more windows and panes to the session.
### Basics of tmux
Stretch your terminal window to make it much larger. Now let’s experiment with a few simple commands to create additional panes. All commands by default start with_Ctrl+b_ .
* Hit_Ctrl+b, “_to split the current single pane horizontally. Now you have two command line panes in the window, one on top and one on bottom. Notice that the new bottom pane is your active pane.
* Hit_Ctrl+b, %_to split the current pane vertically. Now you have three command line panes in the window. The new bottom right pane is your active pane.
Notice the highlighted border around your current pane. To navigate around panes, do any of the following:
* Hit_Ctrl+b_ and then an arrow key.
* Hit_Ctrl+b, q_ . Numbers appear on the panes briefly. During this time, you can hit the number forthe pane youwant.
Now, try using the panes to run different commands. For instance, try this:
* Use_ls_to show directory contents in the top pane.
* Start_vi_in the bottom left pane to edit a text file.
* Run_top_in the bottom right pane to monitor processes on your system.
The display will look something like this:
![tmux session with three panes running different commands](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/Screenshot-from-2017-02-04-12-57-51.png)
So far, this example has only used one window with multiple panes. You can also run multiple windows in your session.
* To create a new window, hit_Ctrl+b, c._Notice that the status bar now shows two windows running. (Keen readers will see this in the screenshot above.)
* To move to the previous window, hit_Ctrl+b, p._
* If you want to move to the next window, hit_Ctrl+b, n_ .
* To immediately moveto a specific window (0-9), hit_Ctrl+b_followed by the window number.
If you’re wondering how to close a pane, simply quit that specific command line shell using_exit_ ,_logout_ , or_Ctrl+d._Once you close all panes in a window, that window disappears as well.
### Detaching and attaching
One of the most powerful features of_tmux_is the ability to detach and reattach to a session. You can leave your windows and panes running when you detach. Moreover, youcan even logout of the system entirely. Then later you can login to the same system, reattach to the_tmux_session, and see all your windows and panes where you left them. The commands you were running stay running while you’re detached.
To detach from a session, hit_Ctrl+b, d._The session disappears and you’ll be back at the standard single shell. To reattach to the session, use this command:
```
tmux attach-session
```
This function is also a lifesaver when your network connection to a host is shaky. If your connection fails, all the processes in the session will stay running. Once your connection is back up, you can resume your work as if nothing happened.
And if that weren’t enough, on top of multiple windows and panes per session, you can also run multiple sessions. You can list these and then attach to the correct one by number or name:
```
tmux list-sessions
```
### Further reading
This article only scratches the surface of_tmux’_ s capabilities. You can manipulate your sessions in many other ways:
* Swapone pane with another
* Move a pane to another window (in the same or a different session!)
* Set keybindings that perform your favorite commands automatically
* Configure a_~/.tmux.conf_file with your favorite settings by default so each new session looks the way you like
For a full explanation of all commands, check out these references:
Paul W. Frields has been a Linux user and enthusiast since 1997, and joined the Fedora Project in 2003, shortly after launch. He was a founding member of the Fedora Project Board, and has worked on documentation, website publishing, advocacy, toolchain development, and maintaining software. He joined Red Hat as Fedora Project Leader from February 2008 to July 2010, and remains with Red Hat as an engineering manager. He currently lives with his wife and two children in Virginia.