Nice Linux prompts to liven up your terminal.

This is a nice script to build a custom PS1 that looks awesome and is simple too.

export PROMPT_COMMAND=__prompt_command
function __prompt_command() {
    local EXIT="$?"
 
    local DEFAULT='\[\e[0m\]'
 
    local RED='\[\e[0;31m\]'
    local GREEN='\[\e[0;32m\]'
    local DARK_GRAY='\[\e[0;90m\]'
    local PURPLE='\[\e[0;35m\]'
    local YELLOW='\[\e[0;33m\]'
 
    PS1="\n${GREEN}\t${DEFAULT} "
 
    if [ "$EXIT" != "0" ]; then
        PS1+="${RED}$EXIT${DEFAULT} "
    else
        PS1+="$EXIT${DEFAULT} "
    fi
 
    JOBSCOUNT=$(jobs -p | wc -l)
    if [ $JOBSCOUNT != "0" ]; then
        PS1+="${YELLOW}$JOBSCOUNT${DEFAULT} "
    fi
 
 
    PS1+="${PURPLE}\w${DEFAULT}\n${DARK_GRAY}\u${DEFAULT}\\$ "
}

This is the prompt this will give you.

21:42:11 0 ~
jason$

This is the default .bashrc prompt for Debian. Use this if the default prompt is what appeals to you.

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

A very simple bash shell prompt. This shows the time and the directory path to your current PWD.

PS1="-\t-- \u@\h [\w]\$ "

Display the current directory path in the terminal title bar.

# Setting the value of the Xterm title.
# Only if we are in X...
if [ $DISPLAY ] ; then
	PROMPT_COMMAND='echo -ne "\033]0;${OSRELEASE}: ${PWD}\007"'
fi

Very useful for getting more information about your current environment.

No comments have been made. Use this form to start the conversation :)

Leave a Reply