Comment goes here
You should log in and post some comments! The link is up there in the toolbar. Go nuts!
 

Add date, time to your bash history and increase it to 5,000 lines

Often, you'll go looking for a shell command that you used in the past - you can remember around when you did it but of course that won't help you because by default the bash history won't show you dates/times. Here is an easy way to remedy that. It won't go into the past and give you dates, but from this point forward you'll know when commands were executed.

There are two ways to do this: globally or per user

Globally: edit /etc/bashrc
Per user: edit ~/.bashrc

Add this to the bottom of the file to add date/time:

export HISTTIMEFORMAT="%h %d %H:%M:%S "


Now, when you type history, it will show this:

340 Jan 20 08:26:40 cd /etc/
341 Jan 20 08:30:07 ls -l|grep conf
342 Jan 20 08:35:22 cp resolv.conf resolv.conf.bak
343 Jan 20 08:35:43 vim resolv.conf


Now let's say that you want more history to be kept - by default it's set to 500 lines. Add this to the bottom to increase it to 5000 lines:
HISTSIZE=5000


Let me know how it works out for you!