Weblog entry #1 for rossen
HISTTIMEFORMAT='%F %T '
export HISTTIMEFORMAT
...and "history" will give you output like:
536 2008-07-14 10:13:02 echo $HISTTIMEFORMAT
537 2008-07-14 10:13:50 cat /etc/profile.local
538 2008-07-14 10:14:52 history
The .bash_history will contain hash-commented timestamps as seconds since the epoch:
#1216023182
echo $HISTTIMEFORMAT
#1216023230
cat /etc/profile.local
#1216023292
history
Comments on this Entry
Very interesting. I have the following function which I find useful:
function h() {
if [ -z "$1" ]
then
history | grep -v " h" | sed 's/[ \t]*$//' | sort -k 2 -r | uniq -f 1 | sort -n
else
history | grep -v " h" | grep $1 | sed 's/[ \t]*$//' | sort -k 2 -r | uniq -f 1 | sort -n
fi
}--
"It's Not Magic, It's Work"
Adam
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
Finding things in my history. I know there are better ways of doing things, but I've found an alias of h=history on a number of systems, so I'm use to using it. With this function I can grep bits of the history out easily without having to change my use of "h" to get my history.
--
"It's Not Magic, It's Work"
Adam
[ Parent | Reply to this comment ]
export PS1="\n[\[\e[1;37m\]\u\[\e[0m\]@\[\e[1;34m\]\H\[\e[0m\]] [\[\e[1;33m\]\d, \t\[\e[0m\]] [\[\e[1;31m\]\!\[\e[0m\]]\n\[\e[1;31m\]\[\e[0m\][\[\e[1;37m\]\w\[ \e[0m\]]\n\[\e[1;37m\]\\$\[\e[0m\] "
put that in your pipe and smoke it, errr, in your bash_profile and source it.
[ Parent | Reply to this comment ]