First, make sure your package list is up to date. Open your terminal and run:
sudo apt update
Now install tmux using the default package manager:
sudo apt install tmux -y
After installation, verify it’s installed correctly:
tmux -V
You should see something like:
tmux 3.4
If you’re planning to use tmux with custom keybindings or a plugin manager, you’ll likely want to create or edit the .tmux.conf
file in your home directory:
nano ~/.tmux.conf
Here’s a basic config you can paste in to get started:
# Remap prefix from 'Ctrl-b' to 'Ctrl-a' unbind C-b set-option -g prefix C-a bind-key C-a send-prefix # Split panes using | and - bind | split-window -h bind - split-window -v unbind '"' unbind % # Enable mouse support set -g mouse on
After editing the file, reload the config without restarting tmux:
tmux source-file ~/.tmux.conf
To start a new tmux session, just run:
tmux
To name your session (useful if you manage many VPS servers):
tmux new -s server-monitor
To detach from a session:
Ctrl + a then d
To list active sessions:
tmux ls
To re-attach:
tmux attach -t server-monitor
Or if you have just one session running:
tmux a
If you want the latest version of tmux and not the one from the Ubuntu package manager, you can build it from source. First, install dependencies:
sudo apt install -y git automake build-essential pkg-config libevent-dev libncurses5-dev
Then clone the latest source:
git clone https://github.com/tmux/tmux.git cd tmux sh autogen.sh ./configure && make sudo make install
Verify again:
tmux -V
This method gives you the bleeding-edge version which might come with the newest features and bug fixes. Great for power users or developers managing multiple VPS instances. Done. You now have tmux installed and ready on Ubuntu 24.10.