tmux attach || tmux new — attaches to existing server process or creates new if it does not exist.
When you are in tmux terminal window you can use next commands to manage your session:
Ctrl+b d — to exit
Ctrl+b c — to create new window
Ctrl+b 0…9 — to switch to window number
Ctrl+b p — to switch to previous window
Ctrl+b n — to switch to next window
Ctrl+b l — to switch to previous active window (from which you switched to current)
Ctrl+b & — to close window (you can also type exit)
In one window you can have several panes:
Ctrl+b % — to split current window to 2 panes vertically
Ctrl+b “ — to split current window to 2 panes horizontally
Ctrl+b q — to see pane number
Ctrl+b →←↑↓ — to switch between panels
Ctrl+b o — next pane
Ctrl+b { or } — left(right) pane
Ctrl+b <alt> →←↑↓ — to adjust pane size
Ctrl+b <space> — switch pane layout between vertical and horizontal
Ctrl+b x — to close panel (or you can do this by typing exit).
Status bar configuration (~/.tmux.conf)
# Set status bar color
set -g status-bg black
set -g status-fg white
set -g status-left ‘#[fg=green]#H’
# Highlight active window
set-window-option -g window-status-current-bg red
# Show the number of users and the status of machine
set -g status-right ‘#[fg=yellow]#(uptime | cut -d “,” -f 2-)’
Allow another user access to your tmux session:
# specify the name of your tmux socket with -S when creating it
tmux -S /tmp/pair
# chmod to allow other users to access it
chmod 777 /tmp/pair
# now the other user can connect with
tmux -S /tmp/pair attach
Sudo your way into another users tmux session
# Have the user create a tmux session
# ls -al /tmp to see which tmux session is owned by the user you want to share sessions with then
# in the following example tmux-502 is the tmux socket folder of the example user 
sudo tmux -S tmux-502/delfault attach
su your way into the session
su username # need user’s password or sudo
tmux attach
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s