How to Fix tmux: command not found in Minimal Linux

Connecting to a remote cloud VPS, bare-metal server, or containerised Docker environment and typing tmux only to be greeted by the shell alert bash: tmux: command not found (or sh: tmux: not found) interrupts command-line session management. The tmux utility is a terminal multiplexer that enables users to manage multiple shell windows within a single terminal instance and detach long-running tasks without dropping active processes upon SSH disconnection. Unlike standard desktop Linux distributions, minimal server installations, cloud-init base images, and lightweight container containers omit terminal multiplexers by default to minimise disk footprints. Installing the package via native package managers and verifying binary path variables restores complete terminal multiplexing capabilities.

Install tmux on Debian, Ubuntu, and Debian-Derived Systems

Debian-based distributions package tmux within official upstream repository mirrors; refreshing package indexes ensures access to current binaries.

  1. Log into your server shell as a privileged user or prepend commands with sudo.
  2. Refresh local package repository indexes by executing:
    sudo apt update
  3. Install the tmux terminal multiplexer package:
    sudo apt install -y tmux
  4. Verify successful installation and check the compiled version string:
    tmux -V
  5. Launch an active multiplexer session by executing:
    tmux

Install tmux on RHEL, CentOS, Rocky Linux, and Alpine

Enterprise and Alpine minimal containers employ different package managers to deploy multiplexer utilities.

  1. On RHEL, CentOS Stream, AlmaLinux, or Rocky Linux, install tmux using DNF:
    sudo dnf install -y tmux
  2. On legacy CentOS 7 systems, install using Yum:
    sudo yum install -y tmux
  3. On lightweight Alpine Linux containers, install using the apk package manager:
    apk update && apk add tmux
  4. On Arch Linux, execute:
    sudo pacman -S --noconfirm tmux

Verify PATH Environment Variables and Create Aliases

If tmux was installed from source or custom directory prefixes (such as /usr/local/bin), non-standard shell PATH variables will prevent the shell from discovering the binary.

  1. Locate the exact physical binary path on your filesystem:
    which tmux || find / -name tmux -type f 2>/dev/null
  2. If the binary is located at /usr/local/bin/tmux, check if that directory is present in your active environment path:
    echo $PATH
  3. If absent, append the binary directory to your shell configuration file (~/.bashrc or ~/.zshrc):
    echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc && source ~/.bashrc
  4. Confirm execution by initiating a detached named session:
    tmux new -s main_session
  5. Detach safely from the session by pressing Ctrl + B followed by D.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.