-
Notifications
You must be signed in to change notification settings - Fork 82
tmux
The tool tmux π can be used to run programs on the server, without the need to be connected all the time.
This tool similar to screen
but newer and cooler.
Firstly, you should reconfigure tmux by adding the file ~/.tmux.conf
on the server:
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind a send-prefix
This changed the default binding Ctrl-b
to Ctrl-a
. (screen also uses Ctrl-a
, it is cooler!)
To create a new session type in
tmux new -s someTitleNoOneCares
You got a new session.
To attach to a random session
tmux attach
If you are attached to the wrong session, simply Press Ctrl-a
and then s
, which will give you a list of all available sessions.
It is wise to do everything inside of session on the server. This way, you never lose your progress if the connection unexpected interrupts.
For this you can adjust the ~/.bashrc
or ~/.bash_profile
(normally it is bashrc but on our server it is bash_profile) and add the following lines:
if [ -z $TMUX ]; then
tmux attach || tmux new -s defaultTitle;
fi
Now create a new connection and you will see it Automatically connects to an existing session or creates a new one.
If you press Ctrl-a
followed by %
or "
it will split your panel horizontally or vertically.
Just hit Ctrl-D
or type in exit
to close your current panel.
Type Ctrl-a
followed by w
to get a list of all sessions and windows