Fireship · @fireship
Tmux in 100 Seconds
Uploaded September 22, 2024 · Length 3:02
Summary
Learn how to use Tmux to organize and manage multiple terminal sessions in a single window.
- tmux
- terminal multiplexer
- linux
- unix
- terminal organization
- session management
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
t-mo an open- Source terminal
- 0:02
multiplexer that can juggle multiple
- 0:04
terminal sessions from a single window
- 0:06
it was created by Nicholas Marriott in
- 0:08
2007 after becoming frustrated with the
- 0:10
limitations of G screen and is offered
- 0:12
under the more permissive BSD license as
- 0:14
you can see here I'm building some
- 0:16
crappy software and I have a terminal
- 0:18
window open for a web server one for
- 0:20
postgress one for my engine X logs one
- 0:22
for htop one for Nano and one for repel
- 0:24
to say hello world it's complete chaos
- 0:26
but things get a lot better if I run
- 0:28
this t-x command first which will summon
- 0:30
this magic little status bar now I can
- 0:32
take all these Terminals and combine
- 0:34
them into a single window where they're
- 0:35
organized in the status bar like an
- 0:36
array I can easily navigate between them
- 0:38
without ever touching the mouse to split
- 0:40
them into panes both horizontally and
- 0:42
vertically and can give each one of them
- 0:43
a custom name and if I accidentally
- 0:45
closed it all is not lost because the
- 0:47
session is still running in the
- 0:48
background also if you're constantly
- 0:50
switching between multiple failed side
- 0:52
projects it's timec consuming to
- 0:53
manually resurrect a bunch of terminal
- 0:55
Windows to set up your environment a
- 0:57
t-mo can be controlled with scripting to
- 0:59
Define sessions programmatically with
- 1:01
just a few lines of bash code we can
- 1:03
instantly fire up multiple terminals for
- 1:05
our project with descriptive names and
- 1:07
fancy colors but you don't even have to
- 1:08
do it all from scratch because t-mo has
- 1:10
a bunch of pre-built plugins like
- 1:12
resurrect will restore your environment
- 1:14
after reboot or use power line to
- 1:15
customize it in ways that would make
- 1:17
even the most flamboyant peacock jealous
- 1:19
to get started install it on any Unix
- 1:21
like machine including Mac OS Linux and
- 1:23
WSL then open up a terminal window and
- 1:26
start a new session go ahead and run any
- 1:28
random process then create a new
- 1:30
terminal window by hitting control Bravo
- 1:32
let go then hit Charlie a new terminal
- 1:34
is pushed onto the stack and we can
- 1:36
navigate between them with contrl B
- 1:38
followed by their index number we can
- 1:39
also navigate with the arrow keys or
- 1:41
split these terminals into panes with
- 1:43
quotee for vertical or percent for
- 1:44
horizontal pretty cool but oh no I just
- 1:47
closed it but it didn't actually die it
- 1:49
only detached from reality if we open up
- 1:51
the terminal we can run t-mo LS to list
- 1:54
out all the active sessions when we find
- 1:55
the one we're looking for we can
- 1:57
reattach to it and get back to work
- 1:59
what's really awesome though is that if


