- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
110 lines
6.8 KiB
Plaintext
110 lines
6.8 KiB
Plaintext
Episode: 3845
|
|
Title: HPR3845: Using tmux, the terminal multiplexer Overview
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3845/hpr3845.mp3
|
|
Transcribed: 2025-10-25 06:31:56
|
|
|
|
---
|
|
|
|
This is Hacker Public Radio Episode 3845 for Friday the 28th of April 2023.
|
|
Today's show is entitled, Using Punks the Terminal Multiplexer Overview.
|
|
It is part of the series Lightweight Apps.
|
|
It is the 50th show of Archer 72 and is about 12 minutes long.
|
|
It carries a clean flag.
|
|
The summary is, Archer 72 uses Tmux and Restore sessions between reboots.
|
|
Oh, this is Archer 72.
|
|
Welcome to Hacker Public Radio.
|
|
In this episode I use Tmux and I layer it so that my main window is on my main computer
|
|
and the other sub-windows are on remote computers or Raspberry Pi's.
|
|
You may be asking, what is Tmux?
|
|
Well, it is a program which runs in a terminal and allows other terminal programs to be run
|
|
inside it.
|
|
Each program inside Tmux gets its own terminal managed by Tmux, which can be accessed from
|
|
the single terminal where Tmux is running.
|
|
This is called multiplexing and Tmux is its terminal multiplexer.
|
|
Tmux and any programs running inside it may be detached from the terminal where it is
|
|
running, the outside terminal, and later reattached to the same or another terminal.
|
|
Tmux runs inside Tmux, may be full-screen interactive programs like VI or top, shells
|
|
like Bash or KSH or any other program that can be run in a Unix terminal.
|
|
There is a powerful feature set to access, manage, and organize programs inside Tmux both
|
|
interactively and from scripts.
|
|
The main uses of Tmux are to protect running programs on a remote server from connection
|
|
drops by running them inside Tmux, allowing programs running on a remote server to be accessed
|
|
from multiple different local computers, work with multiple programs and shells together
|
|
in one terminal a bit like a window manager.
|
|
A terminal I have been using for this is Rock's Term and when you uncheck the show menu bar,
|
|
it has a nice minimal interface, look to it.
|
|
Tmux works on the basis of a prefix key, which by default is Control-B is the prefix.
|
|
In my Tmux.com, I set it to Control-A for the main window.
|
|
Do that by in the Tmux.com set space dash G, space prefix, space C dash A, which stands
|
|
for Control-A.
|
|
This line is unbind space C dash B for Control-B.
|
|
It does what it says, it unbinds the Control-B function.
|
|
The next line bind space C dash A, space and prefix, it binds the Control-A.
|
|
The next line is set W, space dash G, the next line starts with set W, and I won't read
|
|
it out.
|
|
It's a longer command and it sets the colors for the window.
|
|
Now that you have a Tmux.com file, when you open Tmux, you can use T, space, A, space dash
|
|
D, and that opens Tmux by attaching it and the detaching what you have been using before.
|
|
In the case of just starting Tmux new, you will have just a single window labeled zero
|
|
colon and bash if you're using a bash shell.
|
|
You can create a new window or several by using prefix C for Create, and then you repeat
|
|
that several times for a couple of different windows.
|
|
If you want to go back to the original one that you created, use prefix one to go back
|
|
to the first window.
|
|
You might want to make a couple splits, so you use prefix and percent sign which will
|
|
do a horizontal split, and if you want to split that window vertically, use prefix and
|
|
quotation marks.
|
|
Say I'm working on my RetroPi in the first window, I go to prefix one, and it doesn't
|
|
have a name, but by default is bash because I'm working on a bash shell.
|
|
So I use prefix colon, rename dash window, and then I give it a name of RetroPi, it's
|
|
what I'm working on, and then enter.
|
|
So next I want to start up a MUT session, and I hit prefix two to go to the second window
|
|
I had created, and type in MUT, which is my email client, and it starts that up and
|
|
asks for a password, and then I can start looking at my Gmail from there.
|
|
Now I want to go back to my RetroPi window, which I think is, I said is a single window,
|
|
and I do the prefix one, and I want to make a couple splits, like I discussed before,
|
|
and I also want to run T-mux on my RetroPi, but if I use the same prefixes, it won't work
|
|
correctly, so on the RetroPi I changed it up a little, and in the T-mux.com file, instead
|
|
of changing the prefixes to A, I changed it to F. I probably could change it to something
|
|
else, it just seemed logical at the time, on the T-mux.com on the remote servers, and
|
|
bound the prefix to be F, by going back again and setting prefix C-F, unbind C-B for
|
|
CTRL-B, and bind C-F space and prefix.
|
|
Now I can navigate T-mux either locally with CTRL-A, and wherever I want to go, or CTRL-F
|
|
when I'm in the window that has the remote session.
|
|
Prefix O is how you cycle between the different panes in a window, or you can do prefix and
|
|
arrow keys up, down, left, right, or if you want to go from the upper left to the lower
|
|
right, you can do prefix and the down and right arrow at the same time.
|
|
What would happen if you had all the windows set up, and then you either had to reboot
|
|
or the computer shut down, you lose everything, unless you had the T-mux resurrects and T-mux
|
|
continue in plugins.
|
|
To install T-P-M, which is the T-mux plugin manager, T-mux resurrect and T-mux continue
|
|
them, navigate to tilde slash dot T-mux slash plugins, and get clone the plugins into
|
|
that directory.
|
|
If you're ready in a T-mux window, you just need to press prefix I, and it will load
|
|
the plugins.
|
|
This is only after you put the entries for where the plugins are located in your T-mux.com
|
|
file.
|
|
I will leave the complete configuration file in the show notes.
|
|
Be sure to put in the line at the end where it says run space dash B space.
|
|
Also slash dot T-mux slash plugins slash T-P-M slash T-P-M.
|
|
Next create a directory slash dot T-mux slash resurrect.
|
|
This is where T-mux resurrect and T-mux continuum saves are located.
|
|
Do nothing and T-mux continuum saves automatically every 15 minutes.
|
|
At any time use prefix plus control S to save a snapshot of your session.
|
|
To restore a session to the last save before reboot, use prefix plus control R.
|
|
Here are the steps to restore to a previous point in time.
|
|
Make sure you start this with a fresh T-mux instance.
|
|
CD tilde slash dot T-mux slash resurrect.
|
|
Locate the save file you'd like to use for restore file names have a timestamp.
|
|
Then link the last file to the desired save file, ln-sf in the file name last.
|
|
Do restore with T-mux resurrect key prefix plus control R.
|
|
That's all I have, hope it was useful, thank you for listening and be sure to record
|
|
a show if you're on, right?
|
|
You have been listening to Hacker Public Radio at Hacker Public Radio does work.
|
|
Today's show was contributed by a HBR listener like yourself.
|
|
If you ever thought of recording a podcast, click on our contribute link to find out how
|
|
easy it really is.
|
|
The HBR has been kindly provided by an honesthost.com, the internet archive and our sings.net.
|
|
On the Sadois status, today's show is released under Creative Commons, Attribution 4.0 International
|
|
License.
|