BASH Prompt Customization

Customization of the the Bash terminal line

Add the following codes in ~/.bashrc. Every time you open a Bash terminal, the first line will show HH:MM:SS@hostname:workingDirectory # .

export PS1="\t@\H:\w # "

Reference: http://www.blacksheepnetworks.com/security/resources/labs/prompts.html



Bash eternal history

Add the following codes in ~/.bashrc. It will save whatever you type in the command line forever in ~/.bash_eternal_history file.

export HISTTIMEFORMAT="%s "
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \
               "$(history 1)" >> ~/.bash_eternal_history'

Reference: http://www.debian-administration.org/articles/543