Skip to content

Instantly share code, notes, and snippets.

@Manamama
Created March 1, 2023 15:37
Show Gist options
  • Save Manamama/ce196f40a851109c94407656abefca5e to your computer and use it in GitHub Desktop.
Save Manamama/ce196f40a851109c94407656abefca5e to your computer and use it in GitHub Desktop.
# First test gist ;). This is the .bashrc file, which is executed whenever you open a new terminal window
# The following lines set the appearance of the command prompt
if [ "$color_prompt" = yes ]; then
if [ $(id -u) -eq 0 ]; then # check if user is root
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' # root user prompt is red
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' # non-root user prompt is green
fi
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' # if color_prompt is not enabled, use default prompt
fi
# The following line unsets the color_prompt and force_color_prompt variables
unset color_prompt force_color_prompt
# To test the changes made to this file, run the following command:
# nano .bashrc && source .bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment