Book Image

Penetration Testing with the Bash shell

By : Keith Harald Esrick Makan
Book Image

Penetration Testing with the Bash shell

By: Keith Harald Esrick Makan

Overview of this book

Table of Contents (13 chapters)

The prompt string


The prompt string is the string that marks or delimits your bash command line. The default prompt string for Kali Linux is root@kali:#. This string is not a static value and can be changed to whatever you'd like it to be. This section will cover some very useful modifications you can make to your prompt string. We're going to make it display some helpful information about your Linux System.

To control the value displayed as your prompt string, you need to modify the value of the PS1 variable, as seen in the following screenshot:

So you might be wondering when and how this value is set for your bash terminal. Well, as it turns out, the prompt string is set in the ~/.bashrc file that is usually executed as soon as your terminal starts up. Following is the part of the .bashrc file that mentions the prompt string:

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$'
else
    PS1='${debian_chroot...