From f30c008b4064ab1c57d5377416c9fb1eaa466d0d Mon Sep 17 00:00:00 2001 From: KalpitChoudhari Date: Mon, 10 Jul 2023 21:51:49 +0530 Subject: [PATCH] Added tmux installation guide --- SUMMARY.md | 1 + tmux/README.md | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 tmux/README.md diff --git a/SUMMARY.md b/SUMMARY.md index d5e817c3..0b86d770 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -11,6 +11,7 @@ * [tree](iTerm/tree.md) * [fzf](iTerm/fzf.md) * [ack](iTerm/ack.md) +* [tmux](tmux/README.md) * [Git](Git/README.md) * [Git Ignore](Git/gitignore.md) * [Bash Completion](BashCompletion/README.md) diff --git a/tmux/README.md b/tmux/README.md new file mode 100644 index 00000000..46138db8 --- /dev/null +++ b/tmux/README.md @@ -0,0 +1,88 @@ +# Tmux + +Tmux, short for `T`erminal `MU`ltiple`X`er, is a powerful tool that allows users to manage multiple terminal sessions within a single window. With Tmux, you can switch between different sessions and run multiple terminal programs simultaneously, enhancing your productivity and workflow. + +
+ +## Prerequisite + +Before installing Tmux, ensure that you have Homebrew installed on your system. If you don't have Homebrew, you can refer to the [Homebrew installation guide](../Homebrew/README.md) for instructions. + +
+ +## Installation + +```sh +brew install tmux +``` + +Once the installation is complete, you can verify if Tmux is properly installed by typing the following command in your terminal: + +```sh +tmux +``` + +Above command will create a session in current window. + +
+ +## Usage + +### Starting Multiple Sessions with Tmux + +To start a new Tmux session with a specific session name, use the following command: + +```sh +tmux new-session -s SESSION_NAME +``` + +Replace `SESSION_NAME` with the desired name for your session. This command will create a new Tmux session with the given name. + +
+ +### The Prefix Key + +Once you've started a Tmux session, any keys entered are forwarded to the program running in the active pane of the current window. To control Tmux, a special prefix key is used, which is typically `Ctrl + B` by default. + +
+ +### Create new window in current session + +To create a new terminal window within the current Tmux session, press the following keys in the current window: + +> `Ctrl + B`, then release the keys and press `C` + +The prefix key sequence `Ctrl + B` tells Tmux to wait for another key press. After releasing the prefix key, pressing `C` will create a new window in the current session. + +
+ +### Switching Between Windows Within a Tmux Session + +If you've created multiple windows in the current Tmux session, you can switch between them by using the following command: + +> `Ctrl + B`, then release the keys and press the corresponding window number. + +For example, to switch to the first window in the current session, press `Ctrl + B`, release the keys, and then press `1`. Please note that window numbers start from `0`. + +
+ +### Scrolling window in tmux + +In Tmux, scrolling within a window allows you to access previously executed commands and view the output that extends beyond the visible portion of the terminal. + +To scroll within the current window in Tmux, use the following command: +> `Ctrl + B` then release the keys and press `[` + +This key sequence instructs Tmux to enter scroll mode.Once in scroll mode, you can use the arrow keys or the Page Up and Page Down keys to navigate through the terminal's scrollback buffer and view the previous commands and output. + +To exit scroll mode and return to normal mode, press the `q` key. + +
+ +### Exiting From Current Tmux Session + +To exit from a Tmux session, simply type `exit` within the session window, and you will be automatically disconnected from the session. + +
+ +By utilizing Tmux's features, you can effectively manage and organize multiple terminal sessions, improving your command-line experience and overall efficiency.