Introductory commands for tmux and Linux job management
tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached. – tmux man pages
tmux allows for multiple terminals to be run within the same graphical terminal emulator (like gnome-terminal, xterm etc), without having to rely on support for tabs in whatever emulator you might be using. If you quit your terminal application by pressing the ‘x’ on the graphical interface,
tmux will continue to run in the background, making it immune to graphical hiccups and freezes. It also works on headless systems that lack a graphical desktop making it very useful for ssh, troubleshooting and installation of new OSes.
tmux, new terminals open in panes, which open in windows. A window is a viewport, which can show many split terminals in different panes. The default when
tmux starts is to show one terminal in one pane. To copy with the mouse, you need to add
set -g mode-mouse on to you
~/.tmux.conf. For new version, this has changes to
setw -g mouse on. To select text to copy, you must also press the shift button.
Tmux commands in shell
tmux = start a new tmux session tmux ls = list active tmux sessions tmux a = attach latest/first session tmux a -t <num> = attach to target numbered session
Commands inside tmux
c = create new window % = split current pane into two vertical panes " = split current pane into two horizontal panes , = rename window n = switch to next window o = switch to next pane z = zoom in/out one pane d = exit terminal s = switch tmux session
Additional job control
htop = process manager, q to exit <command> = run command in the foreground <command> & = run command in the background ctrl z = suspend current foreground command bg = send current (potentially suspended) command to the background fg = send background or suspended command to the foreground xkill = click with the cursor to kill the offending graphical application