The Essential Tmux Commands Cheat Sheet

The Essential Tmux Commands Cheat Sheet

The Essential Tmux Commands Cheat Sheet

Shortcut

Action

General

¹Ctrl + b

Default prefix key

t

Show time (ESC returns to the terminal)

:

Enter a command (Example: “:new-session”)

list-commands

List all commands that tmux supports

Tmux Terms

Pane

An open command prompt (or pseudo-terminal). Panes may appear side by side or vertically stacked inside a window.

Window

Your view of open panes

Session

A set of open windows

Client

The background process that displays your session

Server

A single server manages all open sessions (Servers and clients are separate processes that each communicate through a socket in /tmp.)

Creating and Managing Panes

%

Split screen or pane in half vertically, creating a new pane on the right



Split screen or pane in half horizontally, creating a new pane at the bottom

Arrow key

Switch to the adjacent pane

o

Switch to the next pane

q

Show pane numbers (when numbers appear, press number to switch to that pane)

{

Move current pane to the left

}

Move current pane to the right

x

Close the current pane

Ctrl + Arrow key

Resize pane in steps of one cell

Alt + Arrow key

Resize pane in steps of five cells

Alt + 1

Arrange panes in the even-horizontal preset layout

Alt + 2

Arrange panes in the even-vertical preset layout

Alt + 3

Arrange panes in the main-horizontal preset layout

Alt + 4

Arrange panes in the main-vertical preset layout

Alt + 5

Arrange panes in the tiled preset layout

Creating and Managing Windows

c

Create a new window

!

Detach pane into a new window

n

Switch to the previous window (in order of creation)

p

Switch to the next window (in order of creation)

l

Switch to the window used most recently

w

List all windows and their corresponding numbers

Window number

Switch to the corresponding window

,

Rename current window

i

Display info about the current window

f

Search for text in open windows (ESC exits the search)

Creating and Managing Sessions

new-session

Create a new session

$

Rename current session

list-sessions

List open sessions

attach-session

Create a new client and attach it to the specified session (-t target-session)

detach-client -s target-session

Detach clients attached to the current session

kill-session

Destroy the current or specified session

¹To activate a shortcut, you must first press and release the prefix key, then press the shortcut key.

More Help With the Linux Command Line

The commands above assist you in adding tmux using multiple panes, windows, and sessions. If you want to form tmux your own, you’ll go further by editing the configuration file stored at the following location:

/etc/tmux.conf

You can also try your hand at scripting.

When you’re working exclusively from the terminal, installing tmux is like installing a window manager. This provides you more flexibility when performing on servers or other devices without an attached screen. Celebrate exploring tmux! And if you are looking for more instruction resources, look at our Linux commands reference cheat sheet next.

Conclusion

I hope you found this handy guide. If you’ve any questions or comments, don’t hesitate to use the shape below.

User Questions:

- What is the tmux command?

tmux may be a terminal multiplexer: it enables various terminals to be created, accessed, and controlled from one screen. tmux could also be detached from a screen and continue running within the background, then later reattached. When tmux is started, it creates a replacement session with one window and displays it on the screen.

What does Ctrl B neutralize tmux?

Note: meaning hold down Ctrl and hit b, then lull on both and hit d. Your session and its processes are still running, but your terminal is now liberal to do something else. You’ll even sign off, eat, then ssh back in (to an equivalent lab computer) and reattach to your still-running tmux session.

Should you use tmux?

Instead of keeping track of the many windows yourself, you’ll use tmux to make, organize, and navigate between them. More importantly, tmux allows you to detach from and reattach sessions so that you’ll leave your terminal sessions running within the background and resume them later.

Pros/Cons of a tmux-Heavy Workflow

https://www.reddit.com/r/vim/comments/duucd0/proscons_of_a_tmuxheavy_workflow/

How many of you’ve got already been enlightened by: term?

https://www.reddit.com/r/vim/comments/c0mlbz/how_many_of_you_have_already_been_enlightened_by/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store