Showing changes from revision #6 to #7:
Added | Removed | Changed
Tmux (and screen) is useful when you want to run a command on a remote machine that takes a long time to complete where you don’t want to keep the connection open during the whole command.
For instance you could start a torrent download on a remote machine, disconnect and then reconnect when the download is finished.
ssh user@machine
tmux
rtorrent <torrent file> # Hit ^S to start, ^K to stop download, ^Q to exit
<C-b d> # to disconnect from tmux session
exit # from ssh connection
When you want to check the download you can attach to the same session again.
ssh user@machine tmux attach [-t session]
When the torrent download is completed you can quit rtorrent and the ssh connection.
You can do a lot of other things with tmux. It support multiple sessions, windows and panes. If you want to enter a tmux command you first need to enter tmux command prompt. This is done by issuing : after the tmux prefix key C-b. In general you control tmux via single letter keybindings (e.g. C-b d) or via commands, by first entering tmux command prompt.
C-b : # Enter tmux command prompt
In the command prompt you may for instance list all supported commands.
C-b : list-commands # or lscm
q # To exit from list view
To exit from the current command enter q.
Other useful commands are.
Window managment …
Ctrl-b c # Create new window
Ctrl-b x # Delete current pane
Ctrl-b n # Move to the next window
Ctrl-b p # Move to the previous window
Ctrl-b l # Move to the previously selected window
Ctrl-b w # List all windows / window numbers
Ctrl-b <window number> # Move to the specified window number, the default bindings are from 0 – 9
Session management …
C-b : new-session # Create new session (alias new)
C-b : kill-session # Kill current session
C-b : list-session # List all sessions (alias ls)
C-b : detach-client # Detach client from sessions (alias detach). Also available via keybinding "C-b d"
Have fun with tmux!