I use linux terminal all day, and if you are like me, you should use tmux, which enables a number of terminals to be created, accessed, and controlled from a single screen, just to be more productive!
So, there're some essential commands for tmux down below.
start a new session
1tmux # session name will be 0,1,2, ... by default 2tmux new -s <session name> # you can set a custom session name
rename an existing session
1tmux rename-session -t <old name> <new name>
detach current session
list running sessions
attach an existing session
1tmux attach -t <session name>
1tmux a -t <session name>
split current pane horizontally
split current pane vertically
switch between panes
C-b <arrow key> # in direction
C-b o # by sequence
make the current pane full screen(same for exit)
resize the current pane in an arrow direction
closing the current pane
create a new window
rename the current window
switch between windows
C-b p # previous
C-b n # next
C-b <num key> # by number
to use vim color scheme inside tmux
Create a tmux config file
Put these lines in the file:
1set -g default-terminal "xterm-256color" 2set -ga terminal-overrides ",*256col*:Tc"
wait, what? I can't scroll up/down inside tmux. it sucks, huh?
Nah, you can do it. You can get into scrolling mode by
C-b [, and quit by
q. Very cool :XD
even better, we can persist tmux sessions between reboots. soooo cool, isn't it?
Tmux has its own plugin ecosystem. A plugin called tmux-resurrect enables us to persist sessions across reboots.
So, there are two ways of installing
tmux-resurrect plugin, and the manual way is my preferred one because I do not use many plugins for tmux.
1mkdir -p ~/.tmux 2cd ~/.tmux 3git clone https://github.com/tmux-plugins/tmux-resurrect
Then add this line to the bottom of
Reload tmux environment:
1tmux source-file ~/.tmux.conf
Wowooo, you are now able to persist any number of sessions across reboots
That's it. Happy tmuxing! :XD