Master tmux: Essential Commands and Keyboard Shortcuts for Linux
This guide introduces tmux, the powerful terminal multiplexer for Linux, covering core session, window, and pane commands along with handy keyboard shortcuts, and also explains how to identify physical network interfaces using ethtool, providing practical examples for everyday system administration.
tmux Overview
tmux (terminal multiplexer) is a powerful tool on Linux that allows managing multiple terminal sessions from a single screen. Users can attach or detach sessions while keeping them running in the background, similar to screen.
Basic Session Commands
tmux new -s <session_name>– create a new session. tmux detach -s <session_name> – detach a session (or press Ctrl‑d). tmux ls or tmux list-sessions – list existing sessions. tmux attach -t <session_name> – attach to a session. tmux kill-session -t <session_name> – kill a session. tmux switch -t <session_id_or_name> – switch to another session. tmux rename-session -t <session_id> <new_name> – rename a session.
Session Keyboard Shortcuts
Ctrl+b d– detach current session. Ctrl+b s – list sessions. Ctrl+b $ – rename current session.
Window Operations
tmux new-window– create a new window. tmux new-window -n <window_name> – create and name a window. tmux select-window -t N – switch to window number N. tmux select-window -t <window_name> – switch to a named window. tmux rename-window – rename current window. tmux kill-window -t <window_id> – close a window.
Window Keyboard Shortcuts
Ctrl+b c – create a new window.
Ctrl+b & – close current window.
Ctrl+b p – go to previous window.
Ctrl+b n – go to next window.
Ctrl+b l – toggle between last two windows.
Ctrl+b w – list windows for selection.
Ctrl+b , – rename window.
Pane (Panel) Operations
tmux split-window– split pane horizontally (default). tmux split-window -h – split pane vertically. tmux kill-pane – close current pane. tmux select-pane -U/D/L/R – move cursor up/down/left/right. tmux swap-pane -U/D – move pane up or down.
Pane Keyboard Shortcuts
Ctrl+b % – split vertically.
Ctrl+b " – split horizontally.
Ctrl+b x – close current pane.
Ctrl+b ; – focus previous pane.
Ctrl+b o – focus next pane.
Ctrl+b { – move pane left.
Ctrl+b } – move pane right.
Ctrl+b Ctrl+o – move pane up.
Ctrl+b Alt+o – move pane down.
Ctrl+b ! – convert pane to a separate window.
Ctrl+b z – toggle pane fullscreen.
Ctrl+b Ctrl+←/→/↑/↓ – resize pane.
Ctrl+b q – show pane numbers.
Identifying Physical Network Interfaces
If a server has multiple network cards and you need to know which ethX corresponds to which physical port, use the ethtool command: ethtool -p eth0 The corresponding physical port will flash its LED, confirming the mapping. If ethtool is not installed, install it via yum install ethtool.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
