LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-17-2014, 12:16 AM   #1
Ananda Bbau
LQ Newbie
 
Registered: May 2012
Posts: 9

Rep: Reputation: Disabled
How to get timestamp for history command?


Hi Folks,

I need to get output of history command with time format. I have to change it in kernel code and needs to compile the code. Going to install the compiled code in server.

Please help me where to change in kernel code.

Thanks,
G.Ananda Babu.
 
Old 09-17-2014, 09:32 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
That isn't a function of the Kernel AFAIK. It's bash.

Code:
echo "export HISTTIMEFORMAT=\"[%h/%d .. %H:%M:%S] - \"" >> /etc/bashrc
Will give you the time of the command in your history on recent RHEL based distros.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] timestamp of command history doesn't show time command was executed? UprLftCstr Linux - Newbie 3 04-17-2014 12:31 PM
How to view the history with the actual timestamp for the commands? sujithspillai90 Linux - Newbie 7 05-03-2013 08:22 AM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 02:14 AM
Timestamp of previous command issued benjaminrtz Linux - General 1 04-16-2005 01:53 AM
shell timestamp command lowspeed Linux - General 2 02-17-2005 04:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration