LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 06-24-2008, 10:17 AM   #1
bilbod
Member
 
Registered: Mar 2003
Posts: 134

Rep: Reputation: 33
Is there a way to find out the last time a program was run?


Is there a way to find out the last time a program was run?
 
Old 06-24-2008, 02:51 PM   #2
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,065

Rep: Reputation: 894Reputation: 894Reputation: 894Reputation: 894Reputation: 894Reputation: 894Reputation: 894
I'm not sure that there is, in general, but you could look at atime (if you haven't turned it off - I usually do, for efficiency) on either the program files or the configuration file. There is a danger with this approach in that something else (e.g., backup, updatedb) could come along and reset it. The same shouldn't be true of mtime.

Maybe you want to say a little more about what you are trying to do - if you are trying to check for rootkits, this is probably the wrong way to do it.
 
Old 06-24-2008, 04:39 PM   #3
bilbod
Member
 
Registered: Mar 2003
Posts: 134

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by salasi View Post
I'm not sure that there is, in general, but you could look at atime (if you haven't turned it off - I usually do, for efficiency) on either the program files or the configuration file. There is a danger with this approach in that something else (e.g., backup, updatedb) could come along and reset it. The same shouldn't be true of mtime.

Maybe you want to say a little more about what you are trying to do - if you are trying to check for rootkits, this is probably the wrong way to do it.
I went down the atime route but it is not useful because anything that touches the program changes it.

Let me tell you what I am trying to do.

I try a lot of programs but always forget to uninstall them so I have a lot of junk on my system that I would like to remove.

The simplest (and quickest) way I could think of to do this was to try to sort the programs by last time used and remove anything that has not been used for a long time.
 
Old 06-25-2008, 01:14 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,488

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
Well, in Unix you have atime, mtime, ctime.
In your scenario, only atime is relevant, although as you've noticed any access changes the time.
Your other hope is any kind of logfile produced, either directly eg /var/log/thatprog, or generically eg look in /var/log/messages for mention of 'thatprog'.
OTOH, if you can't clearly remember using the prog recently, then you prob didn't
 
Old 06-25-2008, 04:02 AM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
This seems like a bass-ackwards way of managing a system.

Some systems have the lastcomm comamnd. See if your distro has this and the accounting software required.

Bash can timestamp its history entries. See man bash, search for HISTTIMEFORMAT. Backup your history file as necessary to meet your needs. Remember, multiple shells will be competing for the history file, so consider how you want to manage that (hint: HISTFILE).
 
Old 06-25-2008, 07:38 AM   #6
bilbod
Member
 
Registered: Mar 2003
Posts: 134

Original Poster
Rep: Reputation: 33
Last time a program was run (SOLVED)

Quote:
Originally Posted by Mr. C. View Post
This seems like a bass-ackwards way of managing a system.
I guess I am just lazy. <g>

Most distros loadup your system with a lot of programs you never use so adding a few more usually doesn't matter.

I have 2 problems I need to solve.

1. I am running out of disk space on one computer so reducing disk usage will help.
2. I am setting up another computer and need a list of my favorite programs to install on it.

Quote:
Some systems have the lastcomm comamnd. See if your distro has this and the accounting software required.
Someone else suggested that to me and I installed the acct suite of programs yesterday and it looks like that will solve my problems.

Quote:
Bash can timestamp its history entries. See man bash, search for HISTTIMEFORMAT. Backup your history file as necessary to meet your needs. Remember, multiple shells will be competing for the history file, so consider how you want to manage that (hint: HISTFILE).
The bash history command only records commands run from a bash shell. Programs launched from a gui menu (or other shells) will not be included.
 
Old 06-25-2008, 11:46 AM   #7
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
You are not likely to be able to maintain a list of the software you install this way. Here's an easier idea. Either jot down the software you install in a text file you leave around for notes, or see if your package manager software can log its output.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a program at boot time crazylegs SUSE / openSUSE 2 12-12-2007 09:08 PM
how we can run our own program at booting time satyanarayanam Linux - General 7 12-12-2007 06:01 AM
How to test a run-time of a C program frankie_DJ Programming 2 10-07-2006 04:03 AM
run program automatically at specific time simon_qwl Programming 2 03-20-2005 10:58 AM
call other program at run time Xiangbuilder Programming 4 10-01-2003 09:53 AM

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

All times are GMT -5. The time now is 11:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration