Tmux will skyrocket your productivity — here's how
Summary
TLDRこの動画は、ターミナルマルチプレクサーであるt-mo(tmux)の使い方とその利点を紹介しています。t-moを使うことで、一つのウィンドウから複数のターミナルセッションを管理し、ウィンドウやペインを分割・結合することができ、作業の効率を大幅に向上させることができます。また、セッションを切断してもプロセスは継続して実行され、後で再接続することで、作業を中断せずに継続できます。動画では、t-moの基本操作や機能、そしてカスタマイズ方法についても触れています。
Takeaways
- 🌟 t-mo(ターミナルマルチプレクサー)は、1つのウィンドウから複数のターミナルセッションを管理できるツールです。
- 🔄 t-moを使えば、水平または垂直にペインを分割し、複数のウィンドウを作成できます。
- 🔗 t-moはセッションを分割し、異なるプログラムを同時に実行することができ、生産性に役立ちます。
- 🔄 t-moセッションを切断しても、後で再接続して作業を続けることができます。
- 🔄 t-moはバックグラウンドで実行されるため、切断してもプロセスは継続します。
- 🔄 t-moのセッションは、異なるターミナルやSSHセッションから復元できます。
- 📝 t-moのコマンドモードでは、ウィンドウやセッションの名前を変更できます。
- 🔄 t-moのセッションは、`t-mo ls`コマンドで一覧表示し、`t-mo attach`で再接続できます。
- 📝 t-moのキーバインドはカスタマイズ可能で、より使いやすい設定に変更できます。
- 🎥 このビデオでは、t-moの使い方と機能を紹介し、次回のビデオではt-moの外観を改善する方法を紹介します。
- 🚀 t-moは開発者やDevOpsエンジニアなど、ターミナルを多く使用する人にとって超能力のような存在です。
Q & A
t-moは何ですか?
-t-moはターミナル・マルチプレクサー(terminal multiplexer)で、一つのウィンドウから複数のターミナル・セッションを管理できるツールです。
t-moを使うことで得られる主な利点は何ですか?
-t-moを使うことで、セッションの永続性、セッション共有、複数のウィンドウとペインの作成、そして生産性の向上が得られます。
t-moで新しいウィンドウを作成するにはどうすればいいですか?
-t-moで新しいウィンドウを作成するには、コントロールキー(Ctrl)とBを同時に押した後にCを押す必要があります。
t-moでウィンドウを切り替えたい場合はどうすればいいですか?
-t-moでウィンドウを切り替えるには、コントロールキー(Ctrl)とBを同時に押した後に、切り替えたいウィンドウの番号を押します。
t-moでペインを分割するにはどうすればいいですか?
-t-moでペインを分割するには、コントロールキー(Ctrl)とBを同時に押した後に、水平分割はPを、垂直分割は二重引用符(Double quote)を押します。
t-moでペインを移動するにはどうすればいいですか?
-t-moでペインを移動するには、コントロールキー(Ctrl)とBを同時に押した後に、上下左右の矢印キーを使って移動します。
t-moでウィンドウの名前を変更するにはどうすればいいですか?
-t-moでウィンドウの名前を変更するには、コントロールキー(Ctrl)とBを同時に押した後にコマンドモードに入り、rename-windowコマンドを使って名前を変更します。
t-moのセッションを切断するにはどうすればいいですか?
-t-moのセッションを切断するには、コントロールキー(Ctrl)とDを同時に押す必要があります。
t-moのセッションを再接続するにはどうすればいいですか?
-t-moのセッションを再接続するには、t-mo attachコマンドを使って切断したセッションに再接続します。
t-moでセッションの名前を変更するにはどうすればいいですか?
-t-moでセッションの名前を変更するには、コントロールキー(Ctrl)とBを同時に押した後にコマンドモードに入り、rename-sessionコマンドを使って名前を変更します。
t-moのセッションを一覧表示するにはどうすればいいですか?
-t-moのセッションを一覧表示するには、t-mo lsコマンドを使ってすべてのセッションを表示します。
Outlines
🛠️ ターミナルマルチプレクサー t-moの紹介
この段落では、t-moというターミナルマルチプレクサーの機能と利点を紹介しています。t-moは、一つのウィンドウから複数のターミナルセッションを管理できるツールで、水平・垂直に分割されたペインを作成し、異なるセッション間を簡単に切り替えることができます。また、t-moをデタッチしても、実行中のプロセスはバックグラウンドで継続し、後で再接続することで直前の状態に戻ることができます。この機能は、開発者やDevOpsエンジニアにとって非常に便利な超能力です。
🔍 t-moの使い方と機能の詳細
この段落では、t-moの使い方と機能について詳しく説明しています。まず、t-moを起動すると、緑色のバーが表示され、これはt-moが動作していることを示しています。新しいウィンドウを作成したり、ペインを分割したり、ペイン間を移動したりすることができます。また、ウィンドウやセッションをリネームしたり、セッションを切断して再接続したりすることもできます。これらの機能は、複数のターミナルを効率的に管理し、生産性を向上させるために役立ちます。
Mindmap
Keywords
💡t-mo
💡CLI tools
💡DevOps
💡session persistence
💡session sharing
💡window and panes
💡leader key
💡detach and reattach
💡renaming windows and sessions
💡configuration
Highlights
t-mo (tmux) is a terminal multiplexer that allows multiple terminal sessions from one window.
t-mo enables splitting panes horizontally and vertically, enhancing productivity for developers and devops personnel.
With t-mo, users can run long processes and detach from the terminal, then reattach later to find the process still running.
t-mo provides persistence, allowing users to start a session, detach, and reattach later to the same session.
Session sharing is possible with t-mo, enabling multiple users to work on the same session, which is useful for pair programming.
t-mo allows users to create new windows and panes, and navigate between them efficiently.
Renaming windows in t-mo is straightforward, using the command mode with the 'rename-window' command.
Detaching from a t-mo session can be done with the 'detach' command (Ctrl+B then 'd'), and reattaching is done with 't-mo attach'.
t-mo sessions can be listed with 't-mo ls', and users can switch between them using the 'switch-session' command.
t-mo's default configuration is functional but can be improved with custom key bindings and settings.
The speaker plans to create a mini course on t-mo, starting with an introduction to its benefits and features.
The video series will also cover how to make t-mo look more aesthetically pleasing and improve key bindings for better usability.
The speaker emphasizes t-mo as a superpower for the terminal, significantly boosting productivity for those who use it effectively.
The video aims to show how t-mo can be integrated into a daily workflow to maximize terminal efficiency.
The speaker's enthusiasm for t-mo is evident, as they share their personal experiences and tips for using it effectively.
The video includes a demonstration of t-mo's basic functionality and how to get started with the tool.
Transcripts
let's say you're developer and you're
working in Vim or neov and you have a
lot of CLI tools and you're doing a lot
of stuff in the terminal or you're a
devops person and you're tailing logs
you're pushing the latest build to
production and you're working on your
pipeline workflows if you're doing a lot
of work in the terminal and you're not
using t-mo you're missing out let me
show you what I'm talking about t-mo
allows me to have multiple terminal
sessions from one window I can split
panes horizontally and vertically and I
can create whole new windows I can then
cycle in between these windows and panes
really easily but what's awesome is I
can do cool stuff like run my servers
and tail something or run a long running
process like let's say I pin google.com
and I want to see what happens I don't
know maybe it's going to go down who
knows if I detach from my terminal and
go do something else I can reattach to
t-o and my stuff is still running t-mo
is a superpow and I'm going to show you
how it works let's get into
[Music]
it
[Music]
now I think t-mo is unbelievable and
it's kind of a superpower for the
terminal and if you're an aspiring neck
beard like me you should learn it in
fact I think it's so important I'm going
to make a little mini course on t-u
starting with this video right now this
is episode one we're going to talk about
why t-mo is great we're going to talk
about how it works and we're going to
show off some of its features and
functionality in the next video I'm
going to show you how to make t-u look
beautiful that's right the t-u session
you saw on the screen before this that's
not how t-mo looks but we'll get there
and then finally I'm going to show you
how I use it in my day-to-day workflow
to get the absolute best productivity
out of my terminal it seriously is
amazing and I'm excited to show you but
first let's talk about
t-mo what the hell is it well it's a
terminal
multiplexer okay got it no all right
well let me show you now let's say
you're a user using a
computer this is me by the
way to
that's me nice to meet you now if I want
to log into my terminal typically what
you have is a single pseudo login to one
terminal instance at a given point in
time we'll call this
pseudo
login so basically if you want to open
another login to a terminal you have to
open a new window or a new
tab is your terminal and it's a on toone
relationship okay but now what if you're
using t-o well t-o allows you to do
something a little bit different here
let's say you're the
user with
t-o you are allowed to have
multiple pseudo terminal
logins tied to just one terminal
session so this is how t-mo works you
get multiple terminal logins for one
user tied to a single single controlling
window it is a multiplexer or MX for
short and it's for the terminal so it's
t-mo that's where the name comes from
and that's essentially how it works and
this gives you a lot of cool things but
one of the best aspects is you can sever
the tie from the controlling window and
then at any other point you can log in
to another terminal maybe it's a
different terminal session maybe your
SSH somewhere and you can restore this
whole entire session
because t-o is running in the background
on whatever computer is running t-mo so
that's just a highle overview of how
t-mo works and how I use it in my
day-to-day so in short just to summarize
t-o has a lot of benefits over using
just your terminal number one you have
persistence which means that you can
start a teamu session detach do
something else maybe you're working on
something different or you go home and
then SSH back into your work computer
when you open up t-u again that session
is still there it persists number number
two you get session sharing which isn't
something we covered and it's not
something I'm going to cover but
essentially you can have t-o set up so
that multiple users can use the same
t-mo session allowing you to pair
program if you're a programmer funny
story I did this at a job once and it
worked pretty well and number three you
have multiple windows and I would also
add and
panes as you saw in the intro you can
split your windows you can split your
panes you can create new windows it's a
great experience for productivity if
you're using a lot of different terminal
programs okay so uh enough chitchat
let's show t-mo off and kind of go over
some of the features I use on a daily
basis as a daily t-mo user now this is
the base t-mo config there's no extra
configuration here so it's going to look
a little bit different than the intro
and the key bindings are going to be
different we'll go over better key
bindings in a future video but this is
what you'll get out of the box so all we
have to type to start t-o is you guessed
it t-mo now this drops us into a
multiplexed terminal and you can tell
because there's this little green bar at
the bottom here that's t-mo running it
shows off some interesting information
like what window you're on what program
you're currently running the user the
time there's a lot of configuration you
can do there as well so now we're in t-o
uh we can do a few things we can create
a new window and by doing that we want
to push the leader button now what's the
leader button it is contrl B so contrl b
c will create a new window and we can
tell that we created a new window
because there is another entry in our
little green bar at the bottom here now
we can go back to our previous window by
typing control B n now that switches the
window that you're currently at you can
also type contrl B and the number of the
window that you want to switch to now
you can see there's a little asteris
icon so you can tell that I'm on window
zero if I want to go to window one crl
B1 if I want to go to window Z control
b0 crl BN we'll cycle through them crl
BN crl BN and there you go those are two
windows now in this window I can split
it to be different panes if I want to
split it horizontally it's control B PR
that is a horizontal split or is that
vertical I can't tell anymore now if I
want to split this paint again
vertically I can do contrl B Double
quote that's what's it vertically now to
cycle through my panes I can do contrl B
up to go up and left to go left arrows
to go in whatever Direction you want so
it's lader Arrow lader Arrow lader down
lader up lader left and so that's how
you create Windows panes and navigate
between all of them but what if you have
multiple windows open and you want to
rename them well that's pretty easy too
control B colon gets you into command
mode in t-mo now that you're in command
mode you can type things like rename
window and then you can type the name of
your new window let's just call it poop
so now you can see our window name has
been updated to poop pretty sweet so
let's say I'm doing something else and I
want to detach from t-mo that is leader
d d for detach now you can see I've
detached from session zero okay awesome
how do I reattach well there's a couple
things you can do first if you want to
just see the list of sessions you can do
t-mo LS that will list all the sessions
that you currently have open in t-mo
pretty neat next if you want to reattach
to your previous session you do t-mo
attach there you go now your session's
back you can see that our window still
has that poop name on it and we're
looking pretty good so talking about
sessions now how do you create another
session in t-mo well let me detach from
t-o and then just type t-mo again that
will create a whole new session for you
you can see that there's no windows no
panes and it's just a blank t-mo
instance so this is cool and all but
what if I want to get back to my
previous session well from within t-o
it's actually really simple leader s
will list all the sessions currently
open in t-o then you can go up and down
to navigate between them and we can see
that our previous session uh zero has
all of our pains and windows and so we
can hit enter to select that one and
we're back in but the session list isn't
very easy to understand how do we rename
sessions well through the command line
we can do leader colon and type rename
session and we'll call this one the poop
session just because we named one of our
Windows poop it seems
fitting so now if we list all of our
sessions we see poop sessions up top and
then our unnamed new session that we
created that's kind of blank is at the
bottom so now it's easier to understand
where your sessions are so then again
now if I detach from this session and
type t-mo LS we see that we have two
sessions I can now reattach to my last
t-mo session and that's not the one I
want so I can just switch it to go to
poop session now if I do a long running
process like pinging google.com let's
say or let's say you're tailing logs at
work and you have to leave and go home
and then maybe SSH into a remote machine
or whatever you can just detach from the
session go do whatever else you know you
can quit this terminal actually you know
yeah so my terminal has been quit I can
reopen iterm and then if I type t-mo
attach there I am I'm reattached to my
last session which was of course poop
session and my ping is still running
t-mo has been running in the background
this whole time so that when I reattach
I'm really just opening the window that
was previously closed and everything
within it has been running pretty
awesome also all my sessions are still
here so in this video we went over a
little bit about how t-o works why maybe
you would want to use it and some of the
benefits you get from it and then we
went over exactly what you can do to get
a great workflow from t-mo but it's not
properly configured I mean out of the
box it's fine you get all the features
and functionality but we can do a lot
better so in the next video I'm going to
show you how to make t-u look amazing
and have much more sane key bindings and
defaults so stick around and
subscribe and hey thanks
[Music]
nerds
5.0 / 5 (0 votes)