Kali Linux Penetration Testing Bible. Gus Khawaja. Читать онлайн. Newlib. NEWLIB.NET

Автор: Gus Khawaja
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Зарубежная компьютерная литература
Год издания: 0
isbn: 9781119719076
Скачать книгу
Tmux New Window

      Tmux Key Bindings

      In Tmux, you must use Ctrl+B to instruct it that you want to execute a Tmux action (command). In fact, the key combination Ctrl+B is the default one. You can always change the default configurations of Tmux in the configuration file. To change this behavior and assign Ctrl+A instead of Ctrl+B, then you must create the config file yourself for the first time. To get the job done, you have two options for creating a config file in Tmux. The first way is to add a user‐specific file called ~/.tmux.conf , and the second way is to add a global file (to all users) under /etc/tmux.conf . In my case (for this example), I will add the configuration file under /etc/tmux.conf (and I will add the configurations for the key bindings in it):

      root@kali:/# touch /etc/tmux.conf root@kali:/# echo unbind C-b>> /etc/tmux.conf root@kali:/# echo set -g prefix C-a>> /etc/tmux.conf root@kali:/# echo bind C-a send-prefix>> /etc/tmux.conf

      Tmux Session Management

      In Figure 1.1, you can see that the name bash has been assigned automatically to your current session.

      Window Rename

      To rename the session, press Ctrl+B first (or Ctrl+A if you made the changes in the config files that we did previously). Then remove your fingers from the keyboard and press the comma (,) key on your keyboard. You should see that the prompt has changed to allow you to rename it. I will call it Window1; then press Enter after finishing the task:

      (rename-window) Window1

      Window Creation

      Splitting Windows

      Navigating Inside Tmux

      Amazing, right? As you can see, the cursor is on the right pane (see Figure 1.3). To switch between panes (subwindows), press Ctrl+B and use the arrow keys on your keyboard (to change left, right, up, and bottom).

      Next, go back to the Window1 session. To switch between windows, press Ctrl+B and then the number of the window (which is 0 according to this example), and we should be back to the first window.

      The final tip for managing Tmux is for scrolling up and down inside a window or a pane session. In fact, you can't use your mouse to scroll up and down in a Tmux session (the mouse scrolling is for commands history). Instead, you need to press Ctrl+B and then [ on your keyboard, and after that you can use the up and down arrow keys on your keyboard to scroll. Once you're done with the scrolling, press Esc or the Q key on your keyboard to go back to the normal mode.

      To close a pane or a window, just use exit like with any regular terminal window session.

      Tmux Commands Reference

DESCRIPTION COMMAND
To rename a window Ctrl+B+,
To open a new window Ctrl+B+C
To split windows vertically Ctrl+B+%
To split windows horizontally Ctrl+B+"
To navigate subwindows Ctrl+B+Left Arrow, Ctrl+B+Right Arrow
To switch between windows Ctrl+B+[window number]
To scroll up Ctrl+B+[+Up Arrow
To scroll down Ctrl+B+[+Down Arrow
To escape the scrolling mode Esc
To close a pane/window Type exit (inside it)

      Understanding the commands for managing users and groups is important because you'll use the information when you learn about privilege escalation later in the book. All the commands in this chapter will help you a lot in your engagements while using Kali Linux (as an OS for your pentests).

      Users Commands

      Low‐privilege users must prepend commands with sudo to execute system commands (and the low‐privilege user must be in the sudo group to execute sudo ). You will be asked for your account password if you want to use the sudo command. For example,