Make your bash prompt look like Kali Linux’s

Running Kali as a daily driver is doable since it’s Debian Linux, but is it suitable or really necessary. No. Not really. You should have a dedicated laptop for running it and only run it to use the tools when ethical or approved to do so.

But there are some features in the Kali UX that you might want to see in your daily driver distro.

One of these features for me is the zsh prompt. I really like the Kali prompt but I use bash.

To make your Linux bash prompt look like the zsh one in Kali Linux, you need to customize the Bash prompt by modifying the .bashrc file in your home directory. The Kali Linux terminal prompt is typically configured to display the username, hostname, and current working directory with specific colors and formats. Here’s how you can achieve a similar look:

Open the Terminal:
Open your terminal on your Linux distribution.

Edit the .bashrc File:
Use a text editor to open the .bashrc file in your home directory. You can use nano, vim, or any other text editor you prefer. Here, we will use nano:

nano ~/.bashrc

Modify the PS1 Variable:
Find the line that defines the PS1 variable. It might look something like this:

PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ‘
Comment it out (never delete anything!) with a hash and replace it with the following configuration to mimic the Kali Linux prompt:

#PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ‘
PS1='[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m]\$ ‘

Another example I found on the web looks like this. Try it out.

PS1=”\033[38;5;209m]┌──[\033[38;5;141m]\u\033[38;5;209m]:\033[38;5;105m]\h\033[38;5;231m]\W\033[38;5;209m]]\n\033[38;5;209m]└─\[\033[38;5;209m]$[\033[37m] “

Finally, here’s one I made. Retain the original PS1 line you commented out, then try appending it to your .bashrc file.

PROMPT_COMMAND=’PS1_CMD1=$(ip route get 1.1.1.1 | awk -F”src ” ‘”‘”‘NR == 1{ split($2, a,” “);print a[1]}'”‘”‘)’; PS1=’\[\e[38;5;191;2m\]Exit status: \[\e[22;7m\]$?\[\e[0m\] \[\e[38;5;202;2m\]${PS1_CMD1}\n\[\e[0;38;5;64;53m\]\d \[\e[38;5;155;2m\]\t\[\e[0m\] \[\e[38;5;202;1;53m\]\u\[\e[22;2;2m\]@\[\e[22m\]\H\[\e[0m\] \n\[\e[38;5;46;2m\]\[\e[38;5;246;4;53m\]\w\[\e[0m\] \n\[\e[38;5;249m\]\$\[\e[0m\]’

Note: You can limit the number of components in the working directory path by setting the PROMPT_DIRTRIM environment variable in your ~/.bashrc file. This is worth doing if you work with exceptionally deep directory paths.

Here’s what each part of this configuration does:

[\033[01;32m]: Sets the color to green.
\u: Displays the username.
@: Adds the “@” character.
\h: Displays the hostname.
[\033[00m]: Resets the color.
:: Adds a colon character.
[\033[01;34m]: Sets the color to blue.
\w: Displays the current working directory.
[\033[00m]: Resets the color.
\$ : Adds the dollar sign for normal users or a hash for the root user, followed by a space.
Save the Changes:
Save the changes in nano by pressing Ctrl+O, then Enter, and exit by pressing Ctrl+X.

Apply the Changes:
To apply the changes you made to the .bashrc file, either close and reopen the terminal or source the .bashrc file:


source ~/.bashrc
After completing these steps, your terminal prompt should look similar to the one in Kali Linux, displaying the username, hostname, and current working directory with the specified colors.

This cool little website allows you to generate custom PS1 prompts for bash that contain just the elements you want. Alternatively, just install zsh and enjoy the additional features that come with it.

Did you like this?
Tip cyberfella with Cryptocurrency

Donate Bitcoin to cyberfella

Scan to Donate Bitcoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to cyberfella

Scan to Donate Bitcoin Cash to cyberfella
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to cyberfella

Scan to Donate Ethereum to cyberfella
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to cyberfella

Scan to Donate Litecoin to cyberfella
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to cyberfella

Scan to Donate Monero to cyberfella
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to cyberfella

Scan to Donate ZCash to cyberfella
Scan the QR code or copy the address below into your wallet to send some ZCash:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.