Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Tmux Installation Guide #361

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up node
uses: actions/setup-node@v2-beta
with:
node-version: '13'
node-version: '14'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
107 changes: 107 additions & 0 deletions tmux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# 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.