You are here

Bash Tips

vi ~/.bashrc #and find the first two occurrences of PS1 (color or not)
PS1='\A ${debian_chroot: #find line begining with PS1= and prepend \A as in this example
  • In RHEL / CentOS
vi /etc/bashrc
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "    # replace this line
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="\A [\u@\h \W]\\$ " # with this one
  • to prevent lines that begin with spaces being saved in bash history, append the following to /etc/profile
grep HISTCONTROL /etc/profile
echo "export HISTCONTROL=ignoreboth" >> /etc/profile
echo $HISTCONTROL      # check status
HISTCONTROL=ignoreboth #set up for this session
Topic: