TMux

So one of the most useful tools I’ve found so far for Linux is called Tmux

I saw this watching ippsec’s youtube videos for HTB (hack the box). It’s great, it allows multiple windows within an ssh session, you can split screen and do other cool things. It’s well worth watching the ippsec videos, they can be found here: https://www.youtube.com/channel/UCa6eh7gCkpPo5XXUDfygQQA

He goes through all the retired HTB boxes and I always pick up a hint or two or see something in an entirely new light. They can be long >1hr but it is well worth it.

As a note, most of these notes are taken from: https://gist.github.com/henrik/1967800 which is another good guide (I just keep loosing the link) So TMUX. First off, quick download: apt install tmux Once installed we need to go into tmux: tmux You should then get a screen like:

Tmux initial view

Ok, so far not too impressive.

To use Tmux you need to do:

Ctrl + b then the tmux command

So the basics:

New Window: Ctrl + b + c

Rename Window: Ctrl + b + ,

Next Window: Ctrl + b + n

What this then lets you have is like this, with the ability to scroll through then using Ctrl + b +n which is dead easy

Yes i’m scanning localhost! Just for an example!

If you have loads of tabs open and you want a specific one you can:

Jump to Window: Ctrl + b + [Num]

If you put in 0 it would jump to the OpenVPN screen, 1 for bash etc

List all Sessions: Ctrl + b + w

You can then use up/down arrows and Enter to select the window you want

What is really awesome, is split screen. This creates a split screen within your current window (e.g 5: SearchSploit)

Verticle Split: Ctrl + b + %

Horizontal Split: Ctrl + b + “

You can do more than 1 split per “window”.

Move Active Split: Ctrl + b + arrow (left/right/up/down)

To close any of the splits, just type exit on the one you want to get rid of.

Close Splits: Exit

If you want to pop a split out to it’s own pane:

Ctrl +b + !

If you then want to re-join it, you need to pane ID to join it to and if you want it to be horizontal or vertical

Ctrl + b + :join-pane -t <pane ID> <-h/-v>

If you need to move any tabs, you can re-order them all:

Re-order tabs: Ctrl + b + . + number to move to

You can only move to a free number though!

If you have too many windows open and want to close one:

Close windows: Ctrl + b + x

A confirmation will appear, click y (default is N)

There are loads more options, some maybe not so useful,

Giant Clock: Ctrl + b + t

But for help, or all the commands you can always do:

Shortcuts: Ctrl + b + ?

If you have split the screen but then need to make it full screen, say you got a reverse shell it’s easy to move it to a new pane:

New Pane: Ctrl + b + !

So there you have it, a few useful commands to start you on your way to using TMux. I haven’t learnt about attaching/detaching windows, but once I do, i’ll write and update for all I find out.

With all my blogs, here are the commands with no chatter inbetween:

  • New Window: Ctrl + b + c
  • Rename Window: Ctrl + b + ,
  • Next Window: Ctrl + b + n
  • Jump to Window: Ctrl + b + [Num]
  • List all Sessions: Ctrl + b + w
  • Verticle Split: Ctrl + b + %
  • Horizontal Split: Ctrl + b + “
  • Pop Out Pane: Ctrl +b + !
  • Move a Pane to a Split: Ctrl + b + :join-pane -t <pane ID> <-h/-v>
  • Move Active Split: Ctrl + b + [arrow] (left/right/up/down)
  • Close Splits: Exit
  • Move Pane: Ctrl + b + !
  • Re-order tabs: Ctrl + b + . + [number to move to]
  • Close/kill windows: Ctrl + b + x
  • Giant Clock: Ctrl + b + t
  • Shortcuts: Ctrl + b + ?