Tmux
Commands
List of Windows:
Ctrl + b, w
Session:
$ tmux new-session -s frontend
$ tmux new -s backend
$ tmux new -s backend -d
$ tmux new -s database -n sql
$ tmux kill-session -t frontend
$ tmux ls
$ tmux list-sessions
$ tmux attach
$ tmux attach -t backend
Inside Tmux
Ctrl + b, t
- clock
Ctrl + b, d
Ctrl + b, c
- create a new window
Ctrl + b, ,
- rename window
Ctrl + b, n
- move to next window
Ctrl + b, p
- move to previous window
Ctrl + b, 0
- move to window with index 0
Ctrl + b, 1
- move to window with index 1
Ctrl + b, w
- display visual menu of windows
Ctrl + b, f
- find a window that contains a string of text
Ctrl + b, %
- split the window vertically, focus on new pane
Ctrl + b, "
- split the window horizontally
Ctrl + b, &
- kill a window with confirmation
Ctrl + b, o
- to cycle through the panes
Ctrl + b, arrow
- to move from around the panes
Ctrl + b, x
- to kill a pane
Ctrl + b, :
- enter command mode
Ctrl + b, o
- cycle through open panes
Ctrl + b, q
- momentarily display pane numbers in each pane
Ctrl + b, [space]
- cycle through various pane layouts
Ctrl + b, z
- maximize current pane
exit
tmux kill-server
- will kill all sessions and tmux server
Notes
You can have multiple sessions. One session for frontend, one for backend etc...
Named sessions come in handy when you want to leave tmux running in the background
Default command prefix is Ctrl + b
$ tmux ls
no server running on /tmp/tmux-1002/default
Since there are no tmux sessions running, tmux itself is not running, so it is not able to handle the request.
When we create a new tmux session, the environment sets up an initial window for us. We can create as many as we’d like, and they will persist when we detach and reattach.