Wednesday, November 3, 2021

[tmux] The most common used tmux commands

 This post can help you quickly learn how to use tmux in just a few minutes.

Get tmux session ready to start (new session)

# new session 
$ tmux new -s {session name}

# or new session without name
$ tmux

# list sessions
$ tmux ls

Split a tmux window into two panes

# <Ctrl+b> + %:split a tmux window into two panes vertically
# <Ctrl+b> + ":split a tmux window into two panes horizontally

# The way to switch to another pane
# <Ctrl + b> + <Arrow keys ← or → >

P.S: If you want to close one of the pane you created, 
you just switch on it and exit it by exit command.

For instance: split a tmux window into two panes vertically


Adjust a splitted pane size

You also are able to ajust  the splitted pane vertically or horizontally.

# The way to adjust a pane
# <Ctrl + b> + <Ctrl + Arrow keys  or  >

For instance: There are 5 panes in the window and I can adjust the currently focused pane.



Attach tmux session or detach it

# <Ctrl+b> + d:Put current session in the background running (detach)

# attach a background session
$ tmux attach-session -t {session name}

# Or
$ tmux a -t {session name}

Delete tmux session

$ tmux kill-session -t {session name}
$ tmux kill-session -t 0


No comments: