Linux: Bash Prompt Setup

By Xah Lee. Date: .

Add Date/Time Stamp to Prompt

linux lxde lxterminal
bash prompt with color and date.

Here's how to add date/time stamp to your bash prompt. Type this in terminal:

PS1='\u@\H • \D{%Y-%m-%d} • \A • \w\n';

Here's what the escape means:

To make it permanent, put the line in ~/.bash_profile.

[see Difference Between .bashrc, .profile, .bash_profile, …?]

For basic bash prompt setting and parameters, see man bash, search for PS1. (type 【h】 for help.)

ISO Date/Time Format for ls

make ls display datetime stamp in ISO date/time format, like 2015-11-22

alias l='ls -AlF --color --time-style=long-iso'

What the indicator mean:

Ignore Duplicates in History

How to make bash not save duplicates in history?
# don't save duplicate lines or lines starting with space

See man bash.

Bash/Terminal Topic

  1. Bash Keys, Terminal Keys, Man Page Keys
  2. Bash Prompt Setup
  3. Bash Color Prompt
  4. .bashrc, .profile, .bash_profile
  5. Virtual Console
  6. Terminal Control Sequence Keys
  7. Reset Terminal
  8. tmux
  9. man page
  10. Bash Manual in Chapters
  11. BASH Shell Misc Tips
  12. Log Terminal Session

If you have a question, put $5 at patreon and message me.