Skip to content

Using tmux to run jobs in the background

Ryan edited this page Aug 14, 2023 · 1 revision

TMUX

Tmux is a terminal multiplexer, allowing users to create multiple viewing panes within a single session, much like having multiple tabs open in a web browser. It's also very useful if you need to run jobs that take a long time and need to disconnect from a server and come back later.

Opening tmux

In the simplest use, just type:

tmux

...and a new tmux session will open.

Doing things in tmux

In general, to perform actions with tmux such as adding new panes, switching to panes, disconnecting from sessions, you must first press ctrl + b. Once you press this combination of keys, you will then press a key to do the action.

Common actions:

  • ctrl + b , then c = open a new pane
  • ctrl + b , then n = go to the next pane
  • ctrl + b , then p = go to the previous pane
  • ctrl + b , then d = disconnect from your tmux session

Reconnecting to an existing tmux session

As listed above, ctrl + b , then d will disconnect from your session. There are ways to have multiple sessions available, but assuming you only have one, to reconnect to the last tmux session used, do the following:

tmux a
Clone this wiki locally