banner
lca

lca

真正的不自由,是在自己的心中设下牢笼。

tmux Usage Record

Overview#

tmux is a terminal multiplexer software similar to GNU Screen, but it is released under the ISC license. Users can use tmux to manage multiple detached sessions, windows, and panels in a single terminal, which is very convenient for using multiple command lines or tasks at the same time.

Installation#

sudo apt install tmux

tmux Sessions#

  • Create a new session
tmux new -s <session_name>
  • Detach a tmux session and return to the shell's terminal environment
ctrl+b d
  • View session list in the terminal environment
tmux ls

image

  • View session list in the session environment
ctrl+b s
  • Enter a tmux session from the terminal environment
tmux a -t session1
  • Destroy a session
# Terminal environment
tmux kill-session -t session1

# Session environment
ctrl+b :
kill-session -t session1
  • Rename a session
# Terminal environment
tmux rename -t old_session_name new_session_name

# Rename a session (in the session environment)
ctrl + b $
  • Modify the name of the current window
crtl+b ,
  • Create a window
ctrl+b c
  • Switch windows
You can switch between multiple windows in the same session using the following shortcuts:

ctrl+b p (the first letter of "previous") - Switch to the previous window.

ctrl+b n (the first letter of "next") - Switch to the next window.

ctrl+b 0 - Switch to window 0, and so on. You can replace the number with any window number.

ctrl+b w (the first letter of "windows") - List all windows in the current session and switch between them using the up and down keys.

ctrl+b l (lowercase letter L) - Switch to the adjacent window.
  • Close a window
ctrl+b &
  • Split the current window vertically (press a percentage sign after the combination key), dividing the current window into left and right screens with a vertical line.
ctrl+b % 
  • Split the current window horizontally (press a double quotation mark after the combination key), dividing the current window into top and bottom screens with a horizontal line.
ctrl+b "
  • Switch panes
ctrl+b o - Switch between panes in the current window.

ctrl+b Up | Down | Left | Right - Select and switch to a pane based on the arrow direction.

ctrl+b Space (space bar) - Rearrange the layout of all panes in the current window. Each time you press it, the layout changes.

ctrl+b z - Maximize the current pane. Press it again to restore.
  • Close a pane
ctrl+b x

time-2021-05-23%20tmux%20f8b2f5455d904dbb94175a83d9e0e235/cheatsheet.jpg

image

References:

http://www.ruanyifeng.com/blog/2019/10/tmux.html
https://www.jianshu.com/p/b67567085856
https://kb.offsec.nl/tools/other/tmux/
https://github.com/tmux/tmux

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.