Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to check command history by Date and Time  (Read 2648 times)

0 Members and 1 Guest are viewing this topic.

lijeshk

  • Guest
How to check command history by Date and Time
« on: November 02, 2013, 01:26:38 pm »

The following command sets the time stamp information associated with each history entry to view the history of the command by date and time:


#HISTTIMEFORMAT="%d/%m/%y %T "

or

#echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile

Where,

%d - Day
%m - Month
%y - Year
%T - Time

Then type history command to view the command history with date and time:

#history

Sample output:

---
 1002  02/11/13 03:43:37 HISTTIMEFORMAT="%d/%m/%y %T "
 1003  02/11/13 03:43:42 pwd
 1004  02/11/13 03:43:48 ls -l
 1005  02/11/13 03:43:56 date
 1006  02/11/13 03:44:13 history
---

 :)