Why tmux feels like magic
tmux stands for terminal multiplexer. It lets you keep several command-line programs inside one terminal: switch between windows, split the screen into panes, and leave a session running when you close your terminal or SSH connection.
For a console-first machine like DarkPC, that means one place for IRC, another for a shell, and another for system checks. No desktop required. No new terminal windows required.
Illustration only, not a live terminal. The kernel version and chat lines are examples.
Check it and start a named session
On Slackware 15.0, first check that tmux is available. The command command -v prints the executable location; tmux -V prints your installed version.
command -v tmux
tmux -V
Open a session with a name you'll remember:
tmux new -s darkpc
You're now in tmux. You'll see your normal shell plus a status bar along the bottom. Nothing dramatic has happened—and that's exactly the point.
DarkPC tip:
tmux new -A -s darkpcis a handy daily launcher. It attaches if thedarkpcsession already exists or creates it if it doesn't.
The one shortcut that unlocks it
The default tmux command prefix is Ctrl+B. Press and release Ctrl + B, then press the next key. Don't hold all the keys together.
For example, Ctrl+B, then C creates a new tmux window. Ctrl+B, then D detaches. Normal typing goes straight through to BitchX or whatever program is active.
Press Ctrl+B, release, then press ? to see tmux's own key-binding list. Press q to leave the list.
Windows, panes and sessions
Think of a session as your workspace, a window as a terminal tab, and a pane as a piece of a split window. A window can hold more than one pane.
| Press these keys | What happens |
|---|---|
Ctrl+B, C | Create a new window |
Ctrl+B, N / P | Next / previous window |
Ctrl+B, 0 to 9 | Jump to a numbered window |
Ctrl+B, , | Rename the current window |
Ctrl+B, % | Split into left and right panes |
Ctrl+B, " | Split into top and bottom panes |
Ctrl+B, Arrow | Move to a neighbouring pane |
Ctrl+B, Z | Zoom / unzoom the active pane |
Ctrl+B, D | Detach without closing the programs |
On a small display, use windows rather than squeezing everything into tiny panes. On a big TV, the splits can be glorious.
A real DarkPC setup: BitchX and a second shell
New to this IRC client? See the full DarkPC BitchX guide for setup, TLS connections and essential IRC commands.
Let's build a genuinely useful workspace using the old-school IRC client. Open tmux first:
tmux new -s irc
In the first window, start BitchX with the executable name used by your installation:
BitchX
Once IRC is running, press Ctrl+B, then C. You're in a fresh shell in window 1. Check your system, edit a file, or run top:
top
Press q to quit top. Press Ctrl+B, then 0 to return to BitchX in window 0. Or try Ctrl+B, then % in the shell window to put a second shell beside it.
For the IRC dinosaurs: tmux keeps BitchX running when you detach, but it does not reconnect IRC after your network drops, and it does not protect processes across a reboot. Your IRC client's own reconnect settings still matter.
Detach, come back, and stay organised
This is the bit that makes tmux addictive: you can step away and come back to the same terminal programs while the computer stays on.
- Inside tmux, press Ctrl+B, then D.
- Back at the ordinary shell, list your sessions:
tmux ls
Rejoin the named session:
tmux attach -t irc
Or use the create-or-reattach shortcut for a regular darkpc workspace:
tmux new -A -s darkpc
Want to close a session on purpose? Exit its running programs and shells normally. You can also use tmux kill-session -t irc from outside that session, but be careful: this terminates the running apps in it.
Scroll back and look around
When IRC flies by or a command fills the screen, press Ctrl+B, then [ to enter copy/scroll mode. Use the arrow keys or Page Up / Page Down to browse previous output. Press q to return to normal.
If you're using tmux inside a graphical terminal, mouse scrolling can be enabled in your tmux configuration. On a plain Linux console, stick with the keyboard; it works anywhere.
Give it a DarkPC flavour (optional)
tmux reads personal settings from ~/.tmux.conf. You can leave the defaults alone or try a small configuration. Save a backup first if you already have that file.
cp -n ~/.tmux.conf ~/.tmux.conf.backup 2>/dev/null || true
vi ~/.tmux.conf
Here's a simple example for ~/.tmux.conf. Use just the lines you want:
# DarkPC: a minimal tmux setup
set -g history-limit 10000
set -g status-style 'bg=black,fg=magenta'
set -g status-left '[ darkpc ] '
# Optional in a graphical terminal; keyboard works everywhere
# set -g mouse on
Reload the file in an existing session from an ordinary shell:
tmux source-file ~/.tmux.conf
Or from inside tmux, press Ctrl+B, then : and enter source-file ~/.tmux.conf. Colour rendering varies between terminals, especially on Linux virtual consoles.
When something goes wrong
| Problem | Try this |
|---|---|
duplicate session: irc | That session already exists. Use tmux attach -t irc or tmux new -A -s irc. |
no server running when listing sessions | There may be no tmux sessions yet. Start one with tmux new -s darkpc. |
| Keys appear in IRC instead of tmux | Press Ctrl+B, release it, then press the command key. |
| Too many panes to read | Use Ctrl+B, Z to zoom one pane; use a new window instead of further splits. |
| IRC disappears after a reboot | Expected. tmux sessions live in memory while the host remains running; restart tmux and your client after reboot. |
For installed-version-specific details, run man tmux. The built-in reference is always there, even when the internet isn't.
The two-minute tmux cheat sheet
| Goal | What to type or press |
|---|---|
| Start a named workspace | tmux new -s darkpc |
| List sessions | tmux ls |
| Reconnect | tmux attach -t darkpc |
| Start or reconnect | tmux new -A -s darkpc |
| New window | Ctrl+B, C |
| Side-by-side panes | Ctrl+B, % |
| Stacked panes | Ctrl+B, " |
| Leave apps running | Ctrl+B, D |
| Scroll history | Ctrl+B, [ |
| Show keys | Ctrl+B, ? |
That's enough to look entirely at home in a terminal-only IRC channel. The rest comes from playing around.