IN-Decent

Re-decentralizing internet with free software

Use Tmux to Improve Shell Productivity

Posted at — Dec 14, 2020

tmux is a terminal multiplexer and can be very useful in when connecting to remote servers with flaky connectivity. Programs keep running even after disconnect and can be re-attached to the existing session and continue working without starting over.

It allows to open multiple windows and panes in a single session and can be easily switched between them.

Getting started with tmux:

  1. create a new tmux session

    tmux
    

    to create a named tmux session, useful to easily identify a session

    tmux new -s <session_name>
    
  2. to re-attach to an already running session

    tmux attach-session -t <session_name>
    #or shorter
    tmux a -t <session_name>
    
  3. to detach from current session and leave everything running, use ctrl+b, d

  4. to list all running sessions

    tmux ls
    
  5. to scroll through the terminal contents, use

    • ctrl+b, <PgUp> to scroll up
    • ctrl+b, <PgDown> to scroll down
  6. to get help about the available commands and their purpose, use ctrl+b, ?.

References:

  1. tmux wiki
  2. Tmux Cheat Sheet & Quick Reference