# Terminals

## tmux

**What is tmux?**&#x20;

tmux  is like screen + terminator combined, The biggest benefit for tmux is  that it run the terminal as a process and not bind to the session,  sessions won’t die if you were disconnected.&#x20;

**How to install?**&#x20;

tmux is build in into Kali, but if not you can install it as ‘apt install tmux’&#x20;

**Starting tmux**&#x20;

For every engagements it’s recommended to create new session which will be for that engagement, by typing:&#x20;

`tmux new –s %NAME%`&#x20;

(replace name with the name of engagement).Notice  on the bottom terminal there is a green line with all the information  on each window. (where there is a star next to the name it mean you  currently viewing this window)Each windows have a number and a name, the name can be changed.For each command we will need to press the prefix key (which is by default ctrl +b) first.&#x20;

**Simple commands:**&#x20;

To start a new windows in the terminal press prefix (ctrl +b) + c.&#x20;

To move between windows press the prefix and the number of the window you want to move to.&#x20;

Change windows name: Prefix + ,&#x20;

Rename the session: Prefix + $&#x20;

**Attach, Detach and Kill:**&#x20;

To  exit the tmux session press prefix + d – and it will detach the current  session and return to your normal shell (this won’t kill your session)&#x20;

To  re-attach the session write ‘tmux attach-session’ or ‘tmux a’ ( we can  even create multiple sessions and attach based on numbers)You can view all the current sessions by running ‘tmux ls’&#x20;

**Tmux configuration file**&#x20;

You can customise the tmux configuration by creating a&#x20;

\~/.tmux.conf&#x20;

tmux will pick this configuration file for your current user&#x20;

In the configuration file you can change the prefix key, extend the scroll back (history)&#x20;

set -g history-limit 10000 (extend the history)&#x20;

set -g allow-rename off (stop from the session to rename the windows automatically)&#x20;

**Splitting screens**&#x20;

Prefix + % - split the screen vertically&#x20;

Prefix + “  -split the screen horizontally&#x20;

Prefix + \<arrow key> to move between the screens&#x20;

Prefix + Z – to zoom into one screen (and also to exit the screen from zoom)&#x20;

Prefix + { - replace the screen location to the left&#x20;

Prefix + } – replace the screen location to the right&#x20;

Prefix + \<Space> -  change layout&#x20;

**Few other tricks:**&#x20;

Press ctrl +a to go to the beginning of the line&#x20;

Press ctrl +e to get to the end of the line&#x20;

Press ctrl and a arrow key to go word by word&#x20;

Prefix+ t  - show the time&#x20;

**To Learn more:**&#x20;

[**https://www.youtube.com/watch?v=Lqehvpe\_djs\&feature=emb\_title**](https://www.youtube.com/watch?v=Lqehvpe_djs\&feature=emb_title)

## Byobu

**What is Byobu?**&#x20;

Byobu is a GPLv3 open source text-based window manager and terminal multiplexer. It was originally designed to provide elegant enhancements to the otherwise functional, plain, practical GNU Screen, for the Ubuntu server distribution. Byobu now includes an enhanced profiles, convenient keybindings, configuration utilities, and toggle-able system status notifications for both the GNU Screen window manager and the more modern Tmux terminal multiplexer, and works on most Linux, BSD, and Mac distributions.&#x20;

**How to install?**&#x20;

On Ubuntu/Kali:&#x20;

`apt install byobu`&#x20;

**Starting Byobu:**&#x20;

To start byobu write in a terminal:&#x20;

`Byobu`&#x20;

**Simple commands:**&#x20;

Shift + F1 - show help menu&#x20;

F2 - to create a new window&#x20;

F3 - move to the left window&#x20;

F4 - move to the right window&#x20;

Shift + F2 - split pane horizontally&#x20;

Ctrl + F2 - split pane vertically&#x20;

Shift + Up/Down/Left/Right - move between splits&#x20;

Ctrl + F3/F4 - move splits around&#x20;

F8 - rename window&#x20;

Shift-Alt-Left/Up/Down/Right - to resize split window&#x20;

Ctrl - F6 - kill split in focus&#x20;

Alt + PageUp/PageDown - scroll in long text (in support vi commands - use '/' to search&#x20;

Shift- F11 - zoom into a pane (and to restore)&#x20;

**Few other tricks:**&#x20;

Ctrl+Shift + F2 - create new session&#x20;

F9 - change the bottom line information options&#x20;

Alt + F11 - take a pane out of split into a new window&#x20;

Ctrl + F11 - join 2 windows together to a split screen&#x20;

To Learn more:&#x20;

<https://www.byobu.org/>

<https://www.youtube.com/watch?v=NawuGmcvKus&feature=emb_title>
