Introduction to tmux

IppSec · Beginner ·💻 AI-Assisted Coding ·8y ago

Key Takeaways

The video introduces Tmux, a terminal multiplexer, and demonstrates its features and usage for window and session management, including creating new sessions, windows, and panes, as well as customizing the configuration and using various key bindings.

Full Transcript

what is going on everyone this is if sec and this video is just gonna be on the way of the console cowboy no exploitation it's just gonna be how i navigate through my terminal split the windows random tips and tricks and bash and of course the team bucks usage is that everyone seems to ask about so let's jump in the biggest benefit to team bucks isn't all the magic you can do which terminal splitting and all that stuff it is the fact that it runs your window in a process and not tied to your session or the background essentially that means if i ssh somewhere then launch team ox do things my and my sh connection dies the process I was doing doesn't die I just reconnect that stage I can attach to my session and I'm back to where I started SuperDuper handy if you ever do sysadmin stuff or pentesting and have like pivots and things I hate when I run commands that's title my sage connection close down or do something and all my stuff guys Vegas hassle so that to me is the best thing about team ox if all you want to do is the terminal splits and all that stuff I recommend looking into Terminator because it makes it just a bit easier it has a few more options on that end but if you want everything with the window background and things like that T MUX is the way to go so this is gonna be how I start all my hack to box videos if you notice I'm in documents HD boxes tea mugs vid so first thing first we have to create a team ox session so team ox new - s and give it a name such as HT B and the reason you want to go in this directory first is when you create a new window it just puts you back into this directory so the first thing I always do in a hack the box video is go into my VPN and then I press ctrl R to recursively search through my history and start typing OpenVPN until it gets me the config I want digested Anna and I connect so then I'm gonna hit a thing called the prefix key by default it is control B so hit the prefix key and then C and I create a new window down here is a little bar that says all the windows if I want to switch back to Open VPN I just hit the prefix key and zero prefix key one to switch to bash if I had a few I can hit one bash three you get the point so my team bucks config is relatively simple I have rebind idli prefix control B to control a the reason I did that is because I used to always use screen and that's what the prefix key was in screen it has a hidden benefit of allow me to do nested tea mug sessions which I will show you real quick so let's open a new window SSH into my cracking rig I can do T MUX LS to list the team buck sessions in this SSH connection I see I have one called miner so T MUX - attached - t for target miner and I attached to this team accession I didn't rebind this to control a so if I do control B C I create a new team ox window inside that SSH connection and if I do control a1 I switch on my main terminal so that is the biggest benefit to changing the bind key I'm going to switch back to one kill this I'm going to do the prefix key D to detach and exit out of my minor the next thing some quality of life I set the history limit to 10,000 that is the scroll back buffer the default is 2,000 this I don't think does anything it's a low rename off as we see the rename works I think maybe it prevents the window from being auto renamed so let's see we'll call this red team because eventually we'll do red team stuff in this pane o window close out them yeah so that prevents it from renaming when I set a static name because I hate it when I was giving windows names and I'd run something it just changes the name to Python that was annoying join windows this means I can send a window to a pain so if I went to here and we do echo test wait my prefix key s and I can send this pain to window number one and now I just joined it so that's handy control s same thing but I can send this where I'm looking at to a different window well I did control s on that window control J if I create this I can say hey give me when uh pain from two and grab it search mode is I set it to VI the creative team bucks is obviously a troll because he set it to emac VI masterrace that is by far superior to Emacs so what that does is allows us to use VI keys more to edit mode so we'll do find slash dev to throw a bunch of stuff to the screen and then we hit the prefix key left bracket and we enter copy mode or edit mode you can tell that by up here we have 384 lines in there scroll back and we can hit page up page down to move around but what the VI keys did is now I can just do question mark tip SEC it'll take me to the previous instance of it set from where my cursor is which is where I enter the command I can do slash shape SEC go the other way down and then if I want to go to the beginning hit spacebar that's going to put me in copy mode I can just hit page down go to the very end copy all this text hit enter that saves it to a buffer and if I go to a temp file I do my prefix key the right bracket and it paste then you have the team Oakes logging plug-in that I use and that simply allows me to do like the prefix key alt shift P and saves everything in this pane to a dog file so if we look at this we can see that was my team accession comes in super handy if you just want to log everything in a pen test before you close down or a CTF I can't tell you how many times I've ran add Maps from hot points forgot to save off the N maps to my server but since I had logging enabled I could just go into the wall and take out the N map output and save it that way or I forgot to write down a password and the password showed at some point in my terminal I can just search and grab it super duper handy that is also one of my favorite things about team ox that's it for the config file I guess now we can show the splitting which is probably what everyone wants I mainly use this where I use it all the time but my favorite use is my one run a bunch of tools so I'm gonna hit the prefix key and percent to do a vertical split run MSF console I'm going to hit the prefix key and double quote do a horizontal split and we're going to run Python simple HTTP server so now we got all the panes in one window you hit control a and the arrow key you can move around you know which pane is active by which one has the green lines around it but this just makes it easy if I have an empire host I want to send it over to Metasploit I can see everything at once and if I'm just working in Empire I hit my prefix key Z to zoom in and that puts it fullscreen do that again to zoom out move it a Metasploit go in and that just makes it really really easy just like having them all three on the same pain because this time is when I want to look at all three all the time if I hit ctrl a and hold ctrl and do arrow keys it resizes but if I let go of control after hitting ctrl a it changes the pain so I think what else to show if I do control a then the left squiggly bracket is going to move Metasploit to the left control a right squiggly bracket move it to the right and you can also do control a spacebar to change how the layout looks so just cycling through a few times we can change how it looks some terminal tricks we already did the control R but if you want to you can do off period so alt period is going to just cycle through your history like argument my argument so if I did like LS / opt and I want to go into opt and I don't want to type all of opt I do CD then hit alt period and it pulls back the last word I typed and if I do it a few times it just cycles through all the words that comes in handy the downside for me rebinding mighty max to control a is control a by default is good at the beginning of the line so if I hit control a twice it goes beginning of the line if I hit control e goes the end of the line that comes in handy if I hold control and hit an arrow key it goes word by word and there's some characters delimiters that will do it so like semicolon control a doesn't go past but that makes it a bit easier to navigate instead of just holding an arrow key C T box did I miss anything I don't know if I missed anything I think this video may be good enough for you to digest now and start playing around with the key bindings o final thing if you hit control your prefix key and question mark it pulls up everything you can do with T MUX and one of the funnier ones that doesn't really have too much use is if you hit the prefix and T it puts a time around so I've only really used this when I'm waiting for a callback so I sent like an email or something or something takes a minute I can throw that time up and just watch the clock tick but the time is also down here so not really too useful yeah I hope you guys enjoyed the video take care and I'll see you around

Original Description

00:17 - Why I like Tmux 01:20 - Creating Tmux Session 01:45 - Bash: Ctrl + R - Recursive Search 02:02 - Tmux: Prefix Key (default Ctrl+B) 02:05 - Tmux: New Window - Prefix c 02:07 - Tmux: Switch Window - Prefix # 02:36 - My Tmux Config 02:50 - Demo of "nested tmux" 04:00 - Tmux: Rename Window - Prefix , 04:20 - Tmux: Send/Join Pane Prefix [s|j] 05:08 - Tmux: Setting Search to Vi mode 05:30 - Tmux: Enter edit mode Ctrl+[ 05:45 - Tmux: Showing off tmux Searching 06:03 - Tmux: Copy and pasting lots of text 06:27 - Tmux: Logging Plugin https://github.com/tmux-plugins/tmux-logging 07:30 - Tmux: Splitting 08:20 - Tmux: Zooming - Prefix z 09:00 - Tmux: Moving Panes 09:20 - Bash: Cycle through past arguments Alt+. 09:50 - Bash: Moving cursor to begin, end or skipping words 10:45 - Tmux: Help Page Prefix ?
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from IppSec · IppSec · 18 of 60

1 HHC2016 - Analytics
HHC2016 - Analytics
IppSec
2 HackTheBox - October
HackTheBox - October
IppSec
3 HackTheBox - Arctic
HackTheBox - Arctic
IppSec
4 HackTheBox - Brainfuck
HackTheBox - Brainfuck
IppSec
5 HackTheBox - Bank
HackTheBox - Bank
IppSec
6 HackTheBox - Joker
HackTheBox - Joker
IppSec
7 HackTheBox - Lazy
HackTheBox - Lazy
IppSec
8 Camp CTF 2015 - Bitterman
Camp CTF 2015 - Bitterman
IppSec
9 HackTheBox - Devel
HackTheBox - Devel
IppSec
10 Reversing Malicious Office Document (Macro) Emotet(?)
Reversing Malicious Office Document (Macro) Emotet(?)
IppSec
11 HackTheBox - Granny and Grandpa
HackTheBox - Granny and Grandpa
IppSec
12 HackTheBox - Pivoting Update: Granny and Grandpa
HackTheBox - Pivoting Update: Granny and Grandpa
IppSec
13 HackTheBox - Optimum
HackTheBox - Optimum
IppSec
14 HackTheBox - Charon
HackTheBox - Charon
IppSec
15 HackTheBox - Sneaky
HackTheBox - Sneaky
IppSec
16 HackTheBox - Holiday
HackTheBox - Holiday
IppSec
17 HackTheBox - Europa
HackTheBox - Europa
IppSec
Introduction to tmux
Introduction to tmux
IppSec
19 HackTheBox - Blocky
HackTheBox - Blocky
IppSec
20 HackTheBox - Nineveh
HackTheBox - Nineveh
IppSec
21 HackTheBox - Jail
HackTheBox - Jail
IppSec
22 HackTheBox - Blue
HackTheBox - Blue
IppSec
23 HackTheBox - Calamity
HackTheBox - Calamity
IppSec
24 HackTheBox - Shrek
HackTheBox - Shrek
IppSec
25 HackTheBox - Mirai
HackTheBox - Mirai
IppSec
26 HackTheBox - Shocker
HackTheBox - Shocker
IppSec
27 HackTheBox - Mantis
HackTheBox - Mantis
IppSec
28 HackTheBox - Node
HackTheBox - Node
IppSec
29 HackTheBox - Kotarak
HackTheBox - Kotarak
IppSec
30 HackTheBox - Enterprise
HackTheBox - Enterprise
IppSec
31 HackTheBox - Sense
HackTheBox - Sense
IppSec
32 HackTheBox - Minion
HackTheBox - Minion
IppSec
33 VulnHub - Sokar
VulnHub - Sokar
IppSec
34 VulnHub - Pinkys Palace v2
VulnHub - Pinkys Palace v2
IppSec
35 HackTheBox - Inception
HackTheBox - Inception
IppSec
36 Vulnhub - Trollcave 1.2
Vulnhub - Trollcave 1.2
IppSec
37 HackTheBox - Ariekei
HackTheBox - Ariekei
IppSec
38 HackTheBox - Flux Capacitor
HackTheBox - Flux Capacitor
IppSec
39 HackTheBox - Jeeves
HackTheBox - Jeeves
IppSec
40 HackTheBox - Tally
HackTheBox - Tally
IppSec
41 HackTheBox - CrimeStoppers
HackTheBox - CrimeStoppers
IppSec
42 HackTheBox - Fulcrum
HackTheBox - Fulcrum
IppSec
43 HackTheBox - Chatterbox
HackTheBox - Chatterbox
IppSec
44 HackTheBox - Falafel
HackTheBox - Falafel
IppSec
45 How To Create Empire Modules
How To Create Empire Modules
IppSec
46 HackTheBox - Nightmare
HackTheBox - Nightmare
IppSec
47 HackTheBox - Nightmarev2  - Speed Run/Unintended Solutions
HackTheBox - Nightmarev2 - Speed Run/Unintended Solutions
IppSec
48 HackTheBox - Bart
HackTheBox - Bart
IppSec
49 HackTheBox -  Aragog
HackTheBox - Aragog
IppSec
50 HackTheBox - Valentine
HackTheBox - Valentine
IppSec
51 HackTheBox - Silo
HackTheBox - Silo
IppSec
52 HackTheBox - Rabbit
HackTheBox - Rabbit
IppSec
53 HackTheBox - Celestial
HackTheBox - Celestial
IppSec
54 HackTheBox - Stratosphere
HackTheBox - Stratosphere
IppSec
55 HackTheBox - Poison
HackTheBox - Poison
IppSec
56 HackTheBox - Canape
HackTheBox - Canape
IppSec
57 HackTheBox - Olympus
HackTheBox - Olympus
IppSec
58 HackTheBox - Sunday
HackTheBox - Sunday
IppSec
59 HackTheBox - Fighter
HackTheBox - Fighter
IppSec
60 HackTheBox - Bounty
HackTheBox - Bounty
IppSec

This video introduces Tmux and demonstrates its features and usage for window and session management, including creating new sessions, windows, and panes, as well as customizing the configuration and using various key bindings. Viewers can learn how to use Tmux to improve their productivity and workflow.

Key Takeaways
  1. Create a new Tmux session using `tmux new -s`
  2. Create a new window in Tmux using `prefix key + C`
  3. Switch between windows in Tmux using `prefix key + 0`
  4. Attach to a Tmux session using `tmux attach -t`
  5. Detach from a Tmux session using `prefix key + D`
  6. Send a window to a different pane using prefix key s
  7. Split panes using prefix key %
  8. Log everything in a pane to a file using prefix key alt shift P
💡 Tmux provides a powerful and flexible way to manage terminal sessions and windows, allowing users to customize their workflow and improve productivity.

Related Reads

📰
Loop Engineering: The Skill That Just Made Your AI Workflow Obsolete
Learn how loop engineering can automate AI workflows, making traditional prompting methods obsolete
Medium · Machine Learning
📰
We built a real-time Pokémon TCG AR overlay for live streams and open-sourced everything
Learn how to build a real-time Pokémon TCG AR overlay using a webcam, gaming PC, and open-source AI
Medium · Deep Learning
📰
The Python Roadmap for AI Engineering in 2026: What You Actually Need to Learn
Learn the essential Python skills for AI engineering in 2026 with a focused roadmap
Medium · Python
📰
Your AI Knows Everything About React. It Knows Nothing About Your React Project.
Learn how AI's knowledge of React has limitations when applied to specific projects, and why understanding these limitations is crucial for effective development
Dev.to AI

Chapters (21)

0:17 Why I like Tmux
1:20 Creating Tmux Session
1:45 Bash: Ctrl + R - Recursive Search
2:02 Tmux: Prefix Key (default Ctrl+B)
2:05 Tmux: New Window - Prefix c
2:07 Tmux: Switch Window - Prefix #
2:36 My Tmux Config
2:50 Demo of "nested tmux"
4:00 Tmux: Rename Window - Prefix ,
4:20 Tmux: Send/Join Pane Prefix [s|j]
5:08 Tmux: Setting Search to Vi mode
5:30 Tmux: Enter edit mode Ctrl+[
5:45 Tmux: Showing off tmux Searching
6:03 Tmux: Copy and pasting lots of text
6:27 Tmux: Logging Plugin
7:30 Tmux: Splitting
8:20 Tmux: Zooming - Prefix z
9:00 Tmux: Moving Panes
9:20 Bash: Cycle through past arguments Alt+.
9:50 Bash: Moving cursor to begin, end or skipping words
10:45 Tmux: Help Page Prefix ?
Up next
Copilot Cowork: Setup, Skills, Plugins & Pricing
Matt Tutorials
Watch →