Welcome to the Linux Hosting Talk.
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011
    Location
    Dublin, PA
    Posts
    1,138
    Rep Power
    10

    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:
    Code:
    export HISTTIMEFORMAT="%h %d %H:%M:%S "
    Now, when you type history, it will show this:
    Code:
    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:
    Code:
    HISTSIZE=5000
    Let me know how it works out for you!

  2. #2
    Join Date
    Dec 2012
    Location
    Waterloo, Ontario
    Posts
    12
    Rep Power
    0
    Great Advice!

    Thanks for the post!

 

 

Similar Threads

  1. Replies: 0
    Last Post: 04-05-2012, 07:24 AM
  2. Replies: 0
    Last Post: 04-02-2012, 11:04 PM
  3. Replies: 0
    Last Post: 02-14-2012, 12:53 PM
  4. AstoundingHost.Com - Softaculous Script Installer | Up-to-date Hardware & Software
    By MustangV10 in forum Web Hosting & Design Specials
    Replies: 1
    Last Post: 11-07-2011, 12:27 PM
  5. Increase filesystem performance w/ noatime
    By Rob in forum On the Server
    Replies: 1
    Last Post: 08-18-2011, 08:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


» Our Friends

Powered by vBadvanced
Back to top