How to add timestamp to history command?

history command lists all executed command on server.

By default output of command is as follows:

989  date
990  history
991  history
992  w
993  top
994  w
995  cd /tmp
996  ls -la

 

After you add timestamp, it will show you a detailed output with date, time and command.

SSH to server as root and edit file /root/.bash_profile with your favorite editor and add following line:

Export HISTTIMEFORMAT="%F %T "
Now logout and login again and execute history command, you will see
Detailed output as follows:-
root@Server[~]#history
19  04/25/10 08:26:48 hostname
20  04/25/10 08:46:34 history
21  04/25/10 08:46:48 w
22  04/25/10 08:46:50 date
23  04/25/10 08:46:52 cal
24  04/25/10 08:46:53 ls -la
25  04/25/10 08:46:55 top
26  04/25/10 08:47:11 tail -f /var/log/messages
27  04/25/10 08:47:29 history
  • 1 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

Can I use my domain name or must I use my IP address as the hostname for FTP?

Using your IP address (192.168.22.22  is an example IP address) is the preferred entry for...

Can you transfer my sites from my current host to my new VPS?

Yes. We will transfer all of your sites free* of charge and will assure that you experience no or...

Do you allow MP3 files? Do you allow streaming of videos?

Yes we do with our special plans at http://hostripples.in/avs-hosting.php

Do you support Cold Fusion?

We do not support or Cold Fusion on our shared hosting servers, however you are more than welcome...