Terminal multiplexer: Difference between revisions
(→tmux*) |
(→Tabby) |
||
(44 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
[https://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/ 5 Ways to Keep Remote SSH Sessions and Processes Running After Disconnection] | [https://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/ 5 Ways to Keep Remote SSH Sessions and Processes Running After Disconnection] | ||
= Tilix = | = Tabby = | ||
* https://tabby.sh/ A terminal for the modern age. Too many features. One of them is it remembers your tabs and split panes. | |||
* [https://www.youtube.com/watch?v=-yfuYPowUDE Tabby - An Open Source Terminal Emulator tool for the modern self hoster]. | |||
* [https://youtu.be/-yfuYPowUDE&t=886 Settings - Profile connection - New - New profile - SSH Connection] . To make the connection, click the icon "Profiles & Connection" next to the "+" sign of the last tab. That's convenient. | |||
* Settings - Hotkeys | |||
** Ctrl + Shift + d: split to the bottom | |||
** F11: full screen | |||
= hyper = | |||
https://hyper.is/ | |||
= Tilix* = | |||
Tilix is a good replacement of the default Terminal in Ubuntu. The blue color for folders in Ubuntu's Terminal make it hard to read in a dark background ([https://askubuntu.com/a/466203 quick fix] by redefining the "di" value in the '''LS_COLORS''' variable). Tilix has better default colors in the dark background. | |||
A tiling terminal emulator for Linux using GTK+ 3 | A tiling terminal emulator for Linux using GTK+ 3 | ||
* https://gnunn1.github.io/tilix-web/ and Ubuntu [https://launchpad.net/~webupd8team/+archive/ubuntu/terminix PPA] for the latest version. | * https://gnunn1.github.io/tilix-web/ and Ubuntu [https://launchpad.net/~webupd8team/+archive/ubuntu/terminix PPA] for the latest version. | ||
* Zoom in by Ctrl + Shift + Plus | * Preferences: | ||
* Change color them by using 'profile. | ** '''Font size''' | ||
*** Zoom in by Ctrl + Shift + Plus. Zoom out by Ctrl + -. | |||
*** The other way is Preferences -> Default -> General. Check "Custom font". | |||
** '''Background image'''. Go to '''Appearance''' and change the 'Background Image'. We can change the ''theme'' in this dialog. Remember to change the '''transparency''' value in the "Color" tab away from 0 in order for the background to work. See [https://www.maketecheasier.com/upgrade-linux-terminal-with-tilix/ Upgrade Your Linux Terminal with Tilix] | |||
** '''Color''': Change color them by using 'profile. The "Material" one looks good. We can also increase the '''Transparency''' . | |||
* [https://www.linuxuprising.com/2018/03/tilix-almost-perfect-tiling-gtk-3.html?m=1 Tilix: The Almost Perfect Tiling GTK+ 3 Terminal Emulator]. You can save and load terminal groups, so you can easily pick up from where you left off, using the exact same terminal layout. My testing is it only saves the layout but not the directories in each pane. | * [https://www.linuxuprising.com/2018/03/tilix-almost-perfect-tiling-gtk-3.html?m=1 Tilix: The Almost Perfect Tiling GTK+ 3 Terminal Emulator]. You can save and load terminal groups, so you can easily pick up from where you left off, using the exact same terminal layout. My testing is it only saves the layout but not the directories in each pane. | ||
* | * Drag and drop file does not work with Terminator but Tilix works fine. | ||
<ul> | |||
<li>How to set Tilix as your default terminal in Pop!_OS and Ubuntu | |||
<pre> | |||
sudo update-alternatives --config x-terminal-emulator | |||
</pre> | |||
From the selection presented, select the option which lists tilix.wrapper. To test you have successfully changed the default to Tilix, open a terminal by pressing CTRL +Alt + T. | |||
</li> | |||
</ul> | |||
= [https://gnometerminator.blogspot.com/p/introduction.html Terminator] = | = [https://gnometerminator.blogspot.com/p/introduction.html Terminator] = | ||
Line 29: | Line 55: | ||
* You can take a screenshot to record the directories for all split screens. | * You can take a screenshot to record the directories for all split screens. | ||
* Right click to open the Preferences. We can change the number of scroll back there to infinity. | * Right click to open the Preferences. We can change the number of scroll back there to infinity. | ||
* To change the title (From the Terminator man pages), | |||
** Ctrl+Alt+W Rename window title. | |||
** Ctrl+Alt+A Rename tab title. | |||
** Ctrl+Alt+X Rename terminal title. | |||
= Wave Terminal = | |||
* https://github.com/wavetermdev/waveterm. Still very early. Got an error when it is trying to connect to a remote host ([https://github.com/wavetermdev/waveterm/issues/208 Unable to install "mshell" on a remote???]). | |||
* [https://www.youtube.com/watch?v=HLX3lwr-6io Wave Terminal Demo] (video) | |||
* [https://news.itsfoss.com/wave-terminal/ Wave: A Modern New Linux Terminal that You'll Love if You Hate Command Line] | |||
= Kitty = | |||
* [https://ostechnix.com/kitty-terminal-emulator/ Unleash Your Productivity With Kitty Terminal Emulator: A Must-Have For Linux Enthusiasts] | |||
* https://sw.kovidgoyal.net/ (same author as Calibre) | |||
* Kitty is a cross-platform, fast, feature-rich, GPU-based terminal emulator1. Tilix is a tiling terminal emulator for Linux using GTK+ 3. | |||
* When comparing Kitty vs Tilix, the Slant community recommends KiTTY for most people. See [https://www.slant.co/versus/501/2467/~kitty_vs_tilix slant.co]. | |||
= GNU screen = | = GNU screen = | ||
Line 52: | Line 93: | ||
= tmux* = | = tmux* = | ||
* https://github.com/tmux/tmux/wiki | * https://github.com/tmux/tmux/wiki | ||
* Syntax change from version 2 to 3. [https://github.com/tmux/tmux/blob/master/CHANGES CHANGES] | |||
* For the prefix key, '''ctrl+a''' is easier than "ctrl+b" to type. '''F1...F4''' works too but F1 will have a conflict with Gnome Terminal. | * For the prefix key, '''ctrl+a''' is easier than "ctrl+b" to type. '''F1...F4''' works too but F1 will have a conflict with Gnome Terminal. | ||
* [https://www.cloudsavvyit.com/1093/how-to-get-started-and-use-tmux/ How to Get Started and Use tmux] | |||
* [https://www.makeuseof.com/install-tmux-linux/ How to Install and Configure Tmux for Linux] | |||
* <span style="color: red">Oh My Tmux!</span>, [https://github.com/gpakosz/.tmux which] let you click between them to switch panes or resize a pane if we turn on the mouse mode (Prefix + m). | |||
** '''<prefix> + a''' as a secondary prefix while keeping <prefix> + b as the default prefix | |||
** If we pay attention enough, we will see the blue line highlighting the current pane. In the case of two horizontal panes, the left blue-line highlights the top pane and the right blue-line highlights the bottom pane. | |||
** When the '''mouse mode''' is on, we can use mouse to switch or resize panes or scroll back pages. | |||
** (Mouse method to select & copy text). | |||
*** When the '''mouse mode''' is on, we can use mouse to select text. | |||
*** When we release the mouse, the text is copied to a buffer. | |||
*** We can use <Prefix> + ] or <prefix> + p to paste the text in the buffer. | |||
*** ''The problem with using the mouse to copy text is we cannot scroll up''. | |||
** ([http://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting-ubuntu/ Keyboard method] to select & copy text). Steps 1-5 can be done with mouse. | |||
**# <span style="color: red"><prefix> + [</span> or <prefix> + Enter to enter the '''copy mode'''. | |||
**# Use arrow key to go to the beginning position. | |||
**# '''<prefix> + Space''' to start the selection. | |||
**# Use arrow key to go to the end position. | |||
**# '''<prefix> + w''' to copy the region. | |||
**# <span style="color: red"><prefix> + ]</span> or <prefix> + p to paste the selection. | |||
** 'q' to exit the '''copy mode'''. | |||
* [https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-linux/ tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User] | * [https://www.2daygeek.com/tmux-a-powerful-terminal-multiplexer-emulator-for-linux/ tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User] | ||
* [https://unix.stackexchange.com/questions/549/tmux-vs-gnu-screen tmux vs. GNU Screen] | * [https://unix.stackexchange.com/questions/549/tmux-vs-gnu-screen tmux vs. GNU Screen] | ||
Line 64: | Line 125: | ||
* [https://github.com/tmux-plugins/tpm Plugin manager] | * [https://github.com/tmux-plugins/tpm Plugin manager] | ||
** [https://github.com/tmux-plugins/tmux-prefix-highlight Prefix highlight] in the status bar. | ** [https://github.com/tmux-plugins/tmux-prefix-highlight Prefix highlight] in the status bar. | ||
** [https://github.com/tmux-plugins/tmux-resurrect/blob/master/README.md tmux Resurrect], Restore tmux environment after system restart. | |||
* tmux is available in biowulf/helix | * tmux is available in biowulf/helix | ||
* In macOS/iTerm2, we need to open Prefs > General and check the option "Application in Terminal may access clipboard" for copy/paste to work using mouse/touchpad. | * In macOS/iTerm2, we need to open Prefs > General and check the option "Application in Terminal may access clipboard" for copy/paste to work using mouse/touchpad. | ||
Line 77: | Line 139: | ||
! Action | ! Action | ||
|- | |- | ||
| (ctrl+b), " | | (ctrl+b), ? | ||
| split the pane horizontally | | Show key binding | ||
|- | |||
| (ctrl+b), " <br/> (ctrl+b), % | |||
| split the pane horizontally, <br/> split the pane vertically | |||
|- | |- | ||
| (ctrl+b), up/down arrow key | | (ctrl+b), up/down arrow key | ||
Line 96: | Line 161: | ||
| (ctrl+b), : | | (ctrl+b), : | ||
(ctrl + | (ctrl + ⌥ ) | ||
resize-pane -U 10 | resize-pane -U 10 | ||
resize-pane -D 10 | resize-pane -D 10 | ||
resize-pane -R 4 | |||
| resize pane | | resize pane | ||
resize the current pane up (works for all four arrows) | resize the current pane up (works for all four arrows) | ||
Line 107: | Line 174: | ||
decrease pane height by 10 | decrease pane height by 10 | ||
expands pane four lines to the right | |||
|- | |- | ||
| (ctrl+b), [ | | (ctrl+b), [ | ||
Line 113: | Line 182: | ||
|- | |- | ||
| (ctrl+b), [ | | (ctrl+b), [ | ||
Space | Ctrl + Space | ||
Ctrl + w | |||
(ctrl+b), ] | (ctrl+b), ] | ||
$ tmux save-buffer foo.txt | $ tmux save-buffer foo.txt | ||
| [https://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/ copy mode] | | [https://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/ copy mode] | ||
Use the arrow key to go to the top first. Select the top of the text | Use the arrow key to go to the top first. Select the top of the text | ||
Line 139: | Line 208: | ||
</pre> | </pre> | ||
= [ | To exit a messed session, use (ctrl+b), d to exit the current session. Then issue '''tmux kill-session -t 0''' to kill that session. | ||
== Save session after reboot == | |||
[https://ostechnix.com/save-and-restore-tmux-environment/ How To Save And Restore Tmux Environments Across Reboots In Linux] | |||
== Raspberry Pi zero == | |||
It seems tmux uses too much resource. The CPU shows 100% usage. After I uninstall tmux, the CPU shows 2-3% usage. | |||
== SSH == | |||
[https://ostechnix.com/enhancing-ssh-login-with-a-tmux-session-selection-menu/ Enhancing SSH Login With A Tmux Session Selection Menu In Linux] | |||
= [https://www.byobu.org/ Byobu] = | |||
Byobu is a GPLv3 open source text-based window manager and [https://en.wikipedia.org/wiki/Terminal_multiplexer terminal multiplexer]. It appeared at [http://dirk.eddelbuettel.com/blog/2018/01/26/#prrd_0.0.2 Think inside the box]. | Byobu is a GPLv3 open source text-based window manager and [https://en.wikipedia.org/wiki/Terminal_multiplexer terminal multiplexer]. It appeared at [http://dirk.eddelbuettel.com/blog/2018/01/26/#prrd_0.0.2 Think inside the box]. | ||
Line 195: | Line 275: | ||
* F6 Detach session and then log out (type 'byobu' to connect again). That is, even you closed a byobu window, it is still in the background. We can test it by using 'htop' or 'ping' commands. | * F6 Detach session and then log out (type 'byobu' to connect again). That is, even you closed a byobu window, it is still in the background. We can test it by using 'htop' or 'ping' commands. | ||
** Type '' 'ps -ef | grep byobu' '' in the ssh connection to find out detached byobu sessions | ** Type '' 'ps -ef | grep byobu' '' in the ssh connection to find out detached byobu sessions | ||
* F7 Enter scrollback mode | * <span style="color: red">F7</span> Enter scrollback mode (you'll see 2 numbers [0/XXX] with a purple background at the top-right corner) | ||
** Move the cursor to the start of the text you want to copy, hit | ** Move the cursor (arrow keys or Alt-PageUp/PageDown keys) to the start of the text you want to copy, hit '''Space''' | ||
** Move the cursor to the end of the text you want to copy and hit | ** Move the cursor to the end of the text you want to copy and hit '''Enter''' | ||
** To paste text, open a text editor and hit Alt + Insert or ctrl-a-]. The first time to use ctrl-a, we need to choose either Screen or Emacs mode (I choose Screen). Use '''byobu-ctrl-a''' to reconfigure change this selection. See [https://help.ubuntu.com/community/Byobu Ubuntu] page. | ** To paste text, open a text editor in the same byobu terminal and hit '''Alt + Insert''' or ctrl-a-]. The first time to use ctrl-a, we need to choose either Screen or Emacs mode (I choose Screen). Use '''byobu-ctrl-a''' to reconfigure change this selection. See [https://help.ubuntu.com/community/Byobu Ubuntu] page. | ||
** Alt-PageUp/PageDown - enter and move through scrollback (fn+Alt+Up/Down on Mac keyboard) | ** Alt-PageUp/PageDown - enter and move through scrollback (fn+Alt+Up/Down on Mac keyboard) | ||
** Press Enter key to exit | |||
* F8 Rename the current window | * F8 Rename the current window | ||
** Shift-F8 Rename the current session (not work on Mac keyboard) | ** Shift-F8 Rename the current session (not work on Mac keyboard) | ||
Line 213: | Line 294: | ||
= Guake = | = Guake = | ||
* https://github.com/Guake/guake | * https://github.com/Guake/guake | ||
* F12 to launch/hide the terminal | |||
* [https://www.linuxuprising.com/2019/05/new-guake-drop-down-terminal-ppa-ubuntu.html New Guake Drop-Down Terminal PPA (Ubuntu And Linux Mint Installation)] | * [https://www.linuxuprising.com/2019/05/new-guake-drop-down-terminal-ppa-ubuntu.html New Guake Drop-Down Terminal PPA (Ubuntu And Linux Mint Installation)] | ||
* [https://www.linuxuprising.com/2021/12/how-to-use-guake-terminal-under-wayland.html How To Use Guake Terminal Under Wayland (GNOME)] | |||
= Zellij = | |||
[https://www.linuxuprising.com/2021/05/zellij-rust-terminal-multiplexer-0120.html Zellij Rust Terminal Multiplexer 0.12.0 Released With Detachable / Persistent Sessions] |
Revision as of 22:19, 5 February 2024
https://en.wikipedia.org/wiki/Terminal_multiplexer
Ways to Keep Remote SSH Sessions and Processes Running After Disconnection
5 Ways to Keep Remote SSH Sessions and Processes Running After Disconnection
Tabby
- https://tabby.sh/ A terminal for the modern age. Too many features. One of them is it remembers your tabs and split panes.
- Tabby - An Open Source Terminal Emulator tool for the modern self hoster.
- Settings - Profile connection - New - New profile - SSH Connection . To make the connection, click the icon "Profiles & Connection" next to the "+" sign of the last tab. That's convenient.
- Settings - Hotkeys
- Ctrl + Shift + d: split to the bottom
- F11: full screen
hyper
Tilix*
Tilix is a good replacement of the default Terminal in Ubuntu. The blue color for folders in Ubuntu's Terminal make it hard to read in a dark background (quick fix by redefining the "di" value in the LS_COLORS variable). Tilix has better default colors in the dark background.
A tiling terminal emulator for Linux using GTK+ 3
- https://gnunn1.github.io/tilix-web/ and Ubuntu PPA for the latest version.
- Preferences:
- Font size
- Zoom in by Ctrl + Shift + Plus. Zoom out by Ctrl + -.
- The other way is Preferences -> Default -> General. Check "Custom font".
- Background image. Go to Appearance and change the 'Background Image'. We can change the theme in this dialog. Remember to change the transparency value in the "Color" tab away from 0 in order for the background to work. See Upgrade Your Linux Terminal with Tilix
- Color: Change color them by using 'profile. The "Material" one looks good. We can also increase the Transparency .
- Font size
- Tilix: The Almost Perfect Tiling GTK+ 3 Terminal Emulator. You can save and load terminal groups, so you can easily pick up from where you left off, using the exact same terminal layout. My testing is it only saves the layout but not the directories in each pane.
- Drag and drop file does not work with Terminator but Tilix works fine.
- How to set Tilix as your default terminal in Pop!_OS and Ubuntu
sudo update-alternatives --config x-terminal-emulator
From the selection presented, select the option which lists tilix.wrapper. To test you have successfully changed the default to Tilix, open a terminal by pressing CTRL +Alt + T.
Terminator
- 20 Useful Terminal Emulators for Linux
- https://wiki.archlinux.org/index.php/Terminator (include some keyboard shortcuts)
- Ctrl + Shift+ O Split terminals horizontally
- Ctrl + Shift+ E Split terminals vertically
- mouse can be used to resize split screens and switch to each screen
- Change the default window size
- Method 1: it can only change the size. nano ~/.config/terminator/config
- Method 2: it can change both the size and geometry position. --geometry parameter.
- Change the font size. I pick 'Ubuntu Mono Regular' 14.
- Keyboard shortcuts
- Shift + Ctrl + p/n: switch to the previous/next view
- Ctrl -: decrease font
- Shift Ctrl +: increase font
- You can take a screenshot to record the directories for all split screens.
- Right click to open the Preferences. We can change the number of scroll back there to infinity.
- To change the title (From the Terminator man pages),
- Ctrl+Alt+W Rename window title.
- Ctrl+Alt+A Rename tab title.
- Ctrl+Alt+X Rename terminal title.
Wave Terminal
- https://github.com/wavetermdev/waveterm. Still very early. Got an error when it is trying to connect to a remote host (Unable to install "mshell" on a remote???).
- Wave Terminal Demo (video)
- Wave: A Modern New Linux Terminal that You'll Love if You Hate Command Line
Kitty
- Unleash Your Productivity With Kitty Terminal Emulator: A Must-Have For Linux Enthusiasts
- https://sw.kovidgoyal.net/ (same author as Calibre)
- Kitty is a cross-platform, fast, feature-rich, GPU-based terminal emulator1. Tilix is a tiling terminal emulator for Linux using GTK+ 3.
- When comparing Kitty vs Tilix, the Slant community recommends KiTTY for most people. See slant.co.
GNU screen
- https://www.howtogeek.com/662422/how-to-use-linuxs-screen-command/
- https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/
- http://unix.stackexchange.com/questions/7453/how-to-split-the-terminal-into-more-than-one-view
How to do it...
- Run screen command first (run sudo apt-get install screen if necessary). You are now inside of a window within screen. This functions just like a normal shell except for a few special characters.
- Create screen windows: Ctrl + a, then c. To close a screen window: exit. Once you close all screen windows, you shall see a message [screen is terminating] on the terminal.
- View a list of open windows: Ctrl + a, then ".
- Switch between windows: Ctrl + a and n for the next window and Ctrl +a and p for the previous window.
- Attaching to and detaching screens: To detach (save) from the current screen session, Ctrl +a, and d (these keyboard shortcuts won't affect current execution). This will drop you into your shell. This is useful when you need to run a time-consuming job or your connection is dropped. To attach to an existing screen, use:
screen -r -d
- Split screen:
- To split the screen horizontally, Ctrl +a and S (capital).
- To unsplit the screen, Ctrl +a and Q (capital).
- To switch from one to the other: Ctrl +a and TAB.
- Note: After splitting, you need to go into the new region and start a new session via Ctrl + a then c before you can use that area.
tmux*
- https://github.com/tmux/tmux/wiki
- Syntax change from version 2 to 3. CHANGES
- For the prefix key, ctrl+a is easier than "ctrl+b" to type. F1...F4 works too but F1 will have a conflict with Gnome Terminal.
- How to Get Started and Use tmux
- How to Install and Configure Tmux for Linux
- Oh My Tmux!, which let you click between them to switch panes or resize a pane if we turn on the mouse mode (Prefix + m).
- <prefix> + a as a secondary prefix while keeping <prefix> + b as the default prefix
- If we pay attention enough, we will see the blue line highlighting the current pane. In the case of two horizontal panes, the left blue-line highlights the top pane and the right blue-line highlights the bottom pane.
- When the mouse mode is on, we can use mouse to switch or resize panes or scroll back pages.
- (Mouse method to select & copy text).
- When the mouse mode is on, we can use mouse to select text.
- When we release the mouse, the text is copied to a buffer.
- We can use <Prefix> + ] or <prefix> + p to paste the text in the buffer.
- The problem with using the mouse to copy text is we cannot scroll up.
- (Keyboard method to select & copy text). Steps 1-5 can be done with mouse.
- <prefix> + [ or <prefix> + Enter to enter the copy mode.
- Use arrow key to go to the beginning position.
- <prefix> + Space to start the selection.
- Use arrow key to go to the end position.
- <prefix> + w to copy the region.
- <prefix> + ] or <prefix> + p to paste the selection.
- 'q' to exit the copy mode.
- tmux – A Powerful Terminal Multiplexer For Heavy Command-Line Linux User
- tmux vs. GNU Screen
- Byobu vs. GNU Screen vs. tmux — usefulness and transferability of skills
- 4 ways to be more productive, using RStudio's terminal
- If byobu is installed, then tmux command will start byobu (a modified tmux).
- Byobu changed the text color of ls output while tmux does not (Ubuntu 18.04).
- Change the default prefix key ("ctrl+b"). Note after a change on ~/.tmux.conf, we need to
- run tmux source-file ~/.tmux.conf
- exit the session and enter again for the change to take effect.
- Plugin manager
- Prefix highlight in the status bar.
- tmux Resurrect, Restore tmux environment after system restart.
- tmux is available in biowulf/helix
- In macOS/iTerm2, we need to open Prefs > General and check the option "Application in Terminal may access clipboard" for copy/paste to work using mouse/touchpad.
Features:
- Split screens
- Don't worry about connection broken (if used remotely) or computer shutdown unexpectedly (it used locally)
- Remember the session including split screens even computer shutdown for any reason. Useful for running a long job (wget, rsync, et al).
Most important keyboard shortcuts:
Keyboard | Action |
---|---|
(ctrl+b), ? | Show key binding |
(ctrl+b), " (ctrl+b), % |
split the pane horizontally, split the pane vertically |
(ctrl+b), up/down arrow key | move around panes |
(ctrl+b), d
exit |
detach
quit a session |
$ tmux ls | list sessions |
$ tmux attach -t 0 | re-attach session 0 |
(ctrl+b), :
(ctrl + ⌥ ) resize-pane -U 10 resize-pane -D 10 resize-pane -R 4 |
resize pane
resize the current pane up (works for all four arrows) increase pane height by 10 decrease pane height by 10 expands pane four lines to the right |
(ctrl+b), [
'q' to quit |
scrollback (Enter copy model) |
(ctrl+b), [
Ctrl + Space Ctrl + w (ctrl+b), ] $ tmux save-buffer foo.txt |
copy mode
Use the arrow key to go to the top first. Select the top of the text Use the arrow key to go to the bottom. Select the Bottom of the text and copy Paste (works in tmux window only. To get the tmux buffer in system clipboard, see here) Save the buffer to a file |
My ~/.tmux.conf file
set -g prefix C-a # change prefix from (C-b) to (C-a) unbind C-b bind C-a send-prefix set -g mouse on # use mouse to scroll and switch panes set-window-option -g mode-keys vi # for copy-paste
To exit a messed session, use (ctrl+b), d to exit the current session. Then issue tmux kill-session -t 0 to kill that session.
Save session after reboot
How To Save And Restore Tmux Environments Across Reboots In Linux
Raspberry Pi zero
It seems tmux uses too much resource. The CPU shows 100% usage. After I uninstall tmux, the CPU shows 2-3% usage.
SSH
Enhancing SSH Login With A Tmux Session Selection Menu In Linux
Byobu
Byobu is a GPLv3 open source text-based window manager and terminal multiplexer. It appeared at Think inside the box.
Resources:
- How To Install and Use Byobu for Terminal Management on Ubuntu 16.04
- https://help.ubuntu.com/community/Byobu
- Cheat sheet: PDF, Png format
Most important keyboard shortcuts:
Keyboard | Action |
---|---|
Shift + F2 | split the pane horizontally |
Shift + up/down arrow key | move around panes |
Shift + Alt + up/down key | resize panes |
F6 | detach |
Summary:
- Mouse is useless
- When used with iTerm on Mac, some keys may have a different behaviors.
- If we want to use the 'byobu' command remotely, we first run a ssh connection to a remote computer. Then we type 'byobu' to start a new session. After some operations, we can type 'exit' to quit the session or use "F6" to detach the session and return to a normal ssh connection.
- Kill a frozen session by byobu kill-session -t 1 where "1" is the session number obtained by byobu list-session
- Cf Session (a complete new terminal), Windows (count from 0, see the status bar), Split (also called pane)
- Some all keyboard shotcuts rely on the Fx keys. It is not easy or may fail to do that on Mac (needs to hold the 'fn' key) keyboard on a ssh connection.
- F1 to go to help, e.g. key bindings. ESC to go back.
- Shift-F1 will open a new window (check the status bar for a new number). 'q' to quit the Help Window.
- Use Alt + Left/Right to move focus among windows
- F2 - create a new window. F3/F4 (or Alt-Left/Alt-Right) - move to previous/next window
- Ctrl-Shift-F2 - create a new session (not work on Mac keyboard?)
- Alt-Up/Down to move between sessions
- Split screen
- Horizontal (up and down): Shift + F2.
- Vertical: Ctrl + F2.
- Again you cannot use mouse to move the focus:(
- Shift + Left/Right/Up/Down to move focus among splits
- 'exit' to close a split
- Shift-F6 to kill a split
- Shift + Alt + arrow keys: resize split screen
- F5 reload profile, refresh status
- Shift-F5 to toggle some presets in the status lines
- F9 - change configuration (will run 'exit' on macOS)
- Legend of color-coded values at the bottom of byobu
- https://linux.die.net/man/1/byobu. Yellow background is load average. Light purple background is related to disk (no work on mac).
- http://manpages.ubuntu.com/manpages/cosmic/en/man1/tmux.1.html#options
- $HOME/.byobu/status file most related to status
- F6 Detach session and then log out (type 'byobu' to connect again). That is, even you closed a byobu window, it is still in the background. We can test it by using 'htop' or 'ping' commands.
- Type 'ps -ef | grep byobu' in the ssh connection to find out detached byobu sessions
- F7 Enter scrollback mode (you'll see 2 numbers [0/XXX] with a purple background at the top-right corner)
- Move the cursor (arrow keys or Alt-PageUp/PageDown keys) to the start of the text you want to copy, hit Space
- Move the cursor to the end of the text you want to copy and hit Enter
- To paste text, open a text editor in the same byobu terminal and hit Alt + Insert or ctrl-a-]. The first time to use ctrl-a, we need to choose either Screen or Emacs mode (I choose Screen). Use byobu-ctrl-a to reconfigure change this selection. See Ubuntu page.
- Alt-PageUp/PageDown - enter and move through scrollback (fn+Alt+Up/Down on Mac keyboard)
- Press Enter key to exit
- F8 Rename the current window
- Shift-F8 Rename the current session (not work on Mac keyboard)
- F11
- Shift-F11 Zoom in/out a split
- Alt-F11 Break a split to a full window
- F12
- Shift-F12 Toggle on/off Byobu's keybindings (say, Byobu's keybindings conflict with some other program)
- Alt-F12 Toggle on/off Byobu's mouse support (move around splits and resize split size). It becomes more complex when we want to select text.
Guake
- https://github.com/Guake/guake
- F12 to launch/hide the terminal
- New Guake Drop-Down Terminal PPA (Ubuntu And Linux Mint Installation)
- How To Use Guake Terminal Under Wayland (GNOME)
Zellij
Zellij Rust Terminal Multiplexer 0.12.0 Released With Detachable / Persistent Sessions