Linux: Bash Prompt Setup
Add Date/Time Stamp to Prompt
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:
\u
- User.
\H
- Host.
\D{%Y-%m-%d}
- Date in “yyyy-mm-dd” format.
\A
- Hour and minute in 24-hour “hh:mm” format.
\w
- Path.
To make it permanent, put the line in ~/.bash_profile
.
〔see Bash Init, .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'
-A
or--almost-all
-
Do not list current directory
.
and parent directory..
. -F
or--classify
-
Append indicator (one of {
/
,->
,*
,=
,|
}) to entries. -l
- Use a long listing format. That is, display perm, owner, group, date, etc. 〔see Linux: File Permissions〕
What the indicator mean:
/
- Directory
->
- Symbolic link
*
- Executable
=
- Unix domain socket
|
- Named pipe
Ignore Duplicates in History
How to make bash not save duplicates in history?# don't save duplicate lines or lines starting with space HISTCONTROL=ignoreboth