🐧
Linux
  • Introduction
  • 🖇️general
    • essentials
    • other commands
    • Superuser-do (sudo)
    • SUID, SGID, sticky bit
    • /dev/null
    • environment variables
    • special variables
    • shebang
  • spool
  • 🔧bash
    • overview
    • redirection
    • loop
    • .bashrc
  • text processing
    • grep
    • sed
    • awk
  • xxd/hexdump
  • text editors
    • nano
    • vi/vim
  • 📂filesystem & directories
    • Filesystem Hierachy Standard (FHS)
      • /etc
        • hosts, hosts.allow, hosts.deny
        • /cron.d
        • /httpd
        • /samba.d
        • hostname
        • crontab
        • shadow
        • passwd
        • profile
        • services
      • /dev
      • /proc
        • version
      • /mnt
      • /opt
      • /sbin
      • /lib
      • /usr
      • /tmp
      • /var
      • /bin
      • /run
    • chroot
  • find
  • locate
  • ⌚processes & jobs
    • cronjob
    • daemon
  • ⛓️system
    • systemctl
    • hostname
    • systemd
  • 🗃️media
    • ffmpeg
    • pdftk
  • 🔒Security
    • ufw
  • firejail
  • apparmor
  • 📦Package management
    • dpkg
    • apt/apt-get
  • Storage
    • lsblk
    • mount/umount
  • df/du
  • user management
    • chsh
  • Networking
    • Introduction
    • routing table/interface management
    • /etc/hosts, /etc/hosts.allow, /etc/hosts.deny
Powered by GitBook
On this page
  1. bash

.bashrc

The.bashrc file is a configuration file found in the user's home directory. It is a script that is executed every time a new interactive non-login Bash shell is started.

Before applying any configurations via the .bashrcfile, ensure that the current shell for the system is bash.

$ echo $SHELL
/usr/bin/bash

The chsh command can be used to change the default login shell (refer to the subsection under USER MANAGEMENT).

Configurations

  1. Changing the prompt design

For example in Kali Linux 2024.4, to change the prompt to backtrack, where the prompt kali@kali-desktop is red in color instead.

Change the line in ~/.bashrc:PROMPT_ALTERNATIVE=twoline to PROMPT_ALTERNATIVE=backtrack. Restart the terminal.

What happens is that this changes the block that is executed in the subsequent case statement, which assigns the PS1 variable a different value.

A custom color can be added too (eg. custom):

PROMPT_ALTERNATIVE=custom
...

...
    case "$PROMPT_ALTERNATIVE" in
        ...
        
        custom)
            PS1='...

Eg.

PROMPT_ALTERNATIVE=twoline

prompt_color='\[\033[01;34m\]'
info_color='\[\033[01;31m\]'

...
...

    case "$PROMPT_ALTERNATIVE" in
        twoline)
            PS1=$prompt_color'┌──${debian_chroot:+($debian_chroot)──}${VIRTUAL_ENV:+(\[\033[0;1m\]$(basename $VIRTUAL_ENV)'$prompt_color')}('$info_color'\u@\h'$prompt_color')-[\[\033[0;1m\]\w'$prompt_color']\n'$prompt_color'└─'$info_color'\$\[\033[0m\] ';
PreviousloopNextgrep

Last updated 5 months ago

🔧