Install Tmux on iSH and how to use tmux

The greatest value of Tmux to me: Avoiding the need to spend a lot of time restoring to the previous state due to network disconnection or Terminal crash.

Install Tmux on iSH

apk add tmux
Install Tmux on iSH
The picture above shows that it has been installed

Type tmux command to start Tmux,and type exit or Ctrl-d exit Tmux and released the session.

Type Ctrl-d ? to display a list of keyboard shortcuts,⚠️ press 注意是同时按住 CtrlD 键,松开后再按 ? 键。

Tmux Command List
Ctrl-b ? : Display a list of keyboard shortcuts

session > window > pane

Tmux
|__ Session A
|   |__ Window A1
|   |   |__ Pane A1a
|   |   |__ Pane A1b
|   |
|   |__ Window A2
|       |__ Pane A2a
|
|__ Session B
    |__ Window B1
    |   |__ Pane B1a
    |
    |__ Window B2
        |__ Pane B2a
        |__ Pane B2b

Session

  • tmux new -s <session-name> # Creating a session
  • tmux ls # View session list
  • tmux attach -t 0 # Attach to a session by session id
  • tmux attach -t <session-name> # Attach to a session by session name
  • tmux a # attach the detached-session, when i ssh to server
  • tmux kill-session -t 0 # Release session by session id
  • tmux kill-session -t <session-name> # Release session by session name
  • tmux kill-server # Release all sessions
  • ctrl-b d : Detach from a session,  leaving everything running in the background
  • ctrl-d: ⚠️ Exit Tmux and release the session
  • ctrl-b s: Choose a session from session list, i prefer type ctrl-b w to view all sessions and windows then choose a session.
  • ctrl-b $: Rename the current session

Window

Tmux Create Windows
ctrl-b w: List all sessions and windows then choose a window.
  • ctrl-b c: Create a new window
  • ctrl-b p: Select the previous window
  • ctrl-b n: Select the next window
  • ctrl-b w: Choose window from a list, see screenshot above
  • ctrl-b ,: Rename the current window

Pane

  • ctrl-b %: Split window horizontally
  • ctrl-b “: Split window vertically
  • ctrl-d: Exit the pane
  • ctrl-b <arrow key>: switch to the pane in whichever direction you press
  • ctrl-b z: Zoom the active pane
  • ctrl-b-<arrow key> (Don’t release Ctrl-b then press arrow key): Resizing panes
  • ctrl-b {: Swap the active pane with the pane above
  • ctrl-b }: Swap the active pane with the pane below

Others

The vim paste under Tmux will automatically indent, which is not what everyone wants to see. Enter :set paste before pasting, and enter :set nopaste after pasting.

Tmux paste indent

Featured Image