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.

Linux Terminal Topic

  1. Linux: Bash Keys, Terminal Keys, Man Page Keys
  2. Linux: Bash Prompt Setup
  3. Difference Between .bashrc, .profile, .bash_profile, …?
  4. Linux: How to use Virtual Console
  5. Linux: Terminal Control Sequence Keys
  6. Linux: Reset Terminal, Clear Screen History
  7. Linux: tmux Tutorial

  1. Linux: man page: text output, reading non-compressed man page, reading unformatted man page
  2. Linux: Bash Manual in Chapters, Using Emacs for Info
  3. Linux: BASH Shell Misc Tips
  4. Linux: Record a Terminal Session, Logging Shell Output

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