The Hotel Hero

Notes by a Sysadmin


Cluster | Philosophy | Stack

Tmux

April 20, 2021 | Stack

There are two popular tools for working with screens/sessions in the terminal; Screen and Tmux. Screen is probably to consider the most native and simple of the two. But, this post will be about the Tmux application.

It does not come as native in contrary to Screen, so you have to install it:

sudo apt install tmux

Start a new Tmux session:

tmux

After this, all commands to Tmux starts with "Ctrl + b"

Start out by getting a list of all commands:

Ctrl+b ?

When creating new sessions, it can be nice to organise them by names instead of the default numerical session names:

tmux new -s session_name

Detach from current session:

Ctrl+b d

List all sessions:

tmux list-sessions

Attach to a session:

tmux a -t [name or number]

To kill panel and in the end the session (if only one panel left):

ctrl+b x

To kill sessions:

tmux kill-session -t [my-session]
or all sessions
tmux kill-server

Working with Windows and Panes

Windows are to be considered as workspaces/tabs. Let's say you have a window called "Dev" and another called "Research".

Panes are visible work areas within the windows.

By default a Window (named 0) is created when you create a new session.

Windows:

Change the name of the current Window:

Ctrl+b ,

To create a new Window:

Ctrl+b c

To navigate between Windows:

Ctrl+b [n or p]

At the bottom bar you can see all Windows listed and "*" for the active Window.

Close current Window:

Ctrl+b &

Panes

Split current Window horisontally in to Panes:

Ctrl+b %

and vertically:

Ctrl+b "

Navigate between panels:

ctrl+b [and arrows]

About

I'm a Sysadmin, network manager and cyber security entusiast. The main purpose of this public "notebook" is for referencing repetitive tasks, but it might as well come in handy to others. Windows can not be supported! But all other OS compliant with the POSIX-standard can (with minor adjustments) apply the configs on the site. It is Mac OSX, RHEL and all the Fedora based distros and Debian based (several 100's of OS's), all the BSD distros, Solaris, AIX and HP-UX.

Links