Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 06-23-2009, 09:55 PM   #1
LQ Newbie
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
URGENT! Is there any command to get a history command lines and time in SUSE Linux.?

I have to trace back what command and when it is used for the last 3 months. It is quite urgent as I have trouble with the system configuration... Please help me.

Thank you in advance.
Old 06-23-2009, 10:02 PM   #2
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
What shell do you use? If it's bash, then
You can find the last 500 commands in your ~/.bash_history file
(that is, unless you set the variables $HISTFILE and $HISTFILESIZE to some other values). The file does NOT keep the dates. I don't know any other location that would save the commands you enter by default.
Old 06-23-2009, 10:07 PM   #3
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Exactly as Uncle_Theodore says; I too don't know/believe that the history is preserved anywhere other than its usual place (wherever that is-- inside .bash_history I think) but: FWIW, it goes by number of commands, not time/date, and while I have my bash history set in the thousands of commands, it sometimes *still* isn't enough, even over a several-day period, so for your future reference, perhaps you should consider setting your history to a very large number.

Old 06-23-2009, 11:29 PM   #4
LQ Newbie
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you so much Uncle_Theodore and GrapefruiTgirl for the advice.

Have a very good day.

Old 06-24-2009, 01:19 AM   #5
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
To keep the dates you have to set the environment variable HISTTIMEFORMAT. You can assign a format similar to that ones of the command date. For example:
export HISTTIMEFORMAT="%Y%m%d %H:%M:%S "
will print history as
20090623 08:19:13 date
20090623 08:19:14 whoami
20090623 08:19:15 make coffee
Old 06-25-2009, 02:14 AM   #6
LQ Newbie
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Colucix, Thank you so much for the advice. I shall try it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping your activities private on Linux - command history, shred, thumbnail cache chromei386 Linux - Security 6 12-11-2008 01:09 PM
Sed command to print matching lines and 2 lines above.. DX398 Programming 12 10-01-2008 08:25 AM
Time Stamps for command history? WingnutOne Linux - Newbie 3 09-11-2007 08:53 AM
Suse live dvd - Can only see console+command lines spider2050 Linux - Newbie 2 08-10-2005 06:41 PM
FREAKISHLY URGENT: How can I change the screen res. through command lines? nealkochhar Linux - Newbie 16 06-09-2004 03:49 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:04 PM.

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