Tmux
Tmux is a terminal multiplexer that allows you to run multiple terminal sessions within a single window. It is used to improve productivity by allowing you to switch between different applications or tasks quickly and easily. Tmux is available for a variety of operating systems, including Linux, macOS, and Windows.
To install
Tmux on Ubuntu, you can use the following command:
sudo apt-get install tmux
This will install Tmux on your system. Once installed, you can start using it by running the tmux
command.
If you encounter any issues during the installation process, you can refer to the Tmux documentation or seek help from the Tmux community.
In summary, to install Tmux on Ubuntu, use the sudo apt-get install tmux
command.
Here are some of the useful commands:
- Open a new session
- attach to the last session
- Split the window vertically.
- Split the window horizontally.
- Deattach from the current session
- Rename a session
- List all sessions
- Scroll up and Down
- Go to a specific line.
- Help
To open a new session and name it, use the following command:
tmux new -s session_name
Replace session_name
with the name you want to give to the session. This will create a new Tmux session with the specified name.
Then, to attach to the newly created session, use the command:
tmux attach -t session_name
This will attach you to the session you just created and named.
tmux -a
attaches to the last session automatically. If there is no previous session, it creates a new session.
To split the window vertically in Tmux, use the following command:
Ctrl + b %
This will split the window vertically into two panes. You can then use Ctrl + b arrow key
to move between the panes. To close a pane, you can use Ctrl + b x
.
To split the window horizontally in Tmux, use the following command:
Ctrl + b "
This will split the window horizontally into two panes. You can then use Ctrl + b arrow key
to move between the panes. To close a pane, you can use Ctrl + b x
.
To detach from the current session, use the following command:
Ctrl + b d
This will detach you from the current session, allowing you to return to the main terminal.
To rename a Tmux session, use the following command:
tmux rename-session -t old_session_name new_session_name
Replace old_session_name
with the name of the session you want to rename and new_session_name
with the new name you want to give to the session.
To list all Tmux sessions, use the following command:
tmux list-sessions
This will display a list of all the currently running Tmux sessions.
To scroll up and down in Tmux, you can use the following command:
Ctrl + b [
This will enter copy mode, which allows you to scroll up and down within the current pane using the arrow keys or the Page Up and Page Down keys. To exit copy mode, press q
.
To go to a specific line in Tmux, you can use the following command:
Ctrl + b g
This will prompt you to enter a line number. Once you enter the line number, Tmux will take you to that line in the current pane.
To get help in Tmux, you can use the following command:
tmux -h
This will display a list of available options and commands. You can also refer to the Tmux documentation or seek help from the Tmux community if you encounter any issues.