Tmux: A versatile and handy Tool for Sysadmins

george udosen
3 min readSep 15, 2018

--

Ok, the other day I met byobu tool and discovered that underneath all that was another tool called tmux. So I decided to investigate and I quickly fell in love with it.

Now tmux makes it possible to play with your terminal in Ubuntu like you wouldn’t be able if rained on the moon :-). There two ways I love to start tmux, which are

  • tmux — normal way, or
  • tmux new -s <session_name>

The latter makes it possible for me to reach any of the created sessions from a navigation command or say attach one session to another and all that other cool stuffs I haven’t learnt to use yet.

In tmux we have “windows”, “panes”, and “sessions”. These all allow us to do beautiful things in the terminal except “nuking mars”… ;-). When you start tmux it creates a new window and we can split that window into panes with the commands

  • Ctrl + b, then % : for vertical splits
  • Ctrl + b, then “ : for horizontal splits

Of course we can split these ‘panes’ into more regions

I can have multiple “windows” created like in the image below, here I have created three “windows” [0:bash 1:bash- 2:bash*], the “*” indicating which one I am on currently.

Another cool feature is the ability to scroll the terminal screen to see previous command results where you would normally need to use the mouse here we just use the “arrow” buttons to do this, and if you familiar with “vi” the the navigation style of “vi” is application here to. To do this you run the command Ctrl + b, then [ and you can move about without any fear of harassment from the police :-0.

To return to the cursor line just type q and your back home.

To navigate we use the following commands;

  • Between panes ctrl + b, then arrow keys [up | down | left | right]
  • Between windows Ctrl + b, then n or p , n : next, p : previous
  • Between sessions Ctrl + b, then ( or )
  • Move a pane left or right Ctrl + b, then { or }

To close

  • a pane Ctrl + b, then x and type y or n to execute
  • a window Ctrl + b, then & and type y or n
  • a session Ctrl + b, then : to get the command mode after type kill-session -t <name_of_session>
  • tmux exit

For more goodies see link below:

https://tmuxcheatsheet.com/

--

--

george udosen
george udosen

Written by george udosen

DevOps | FullStack developer | Python::Flask | GCP Cloud Certified | AWS & AZURE Cloud Savy | Linux Sysadmin | Google IT Support

No responses yet