LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find and list files modified since system was booted (https://www.linuxquestions.org/questions/linux-newbie-8/find-and-list-files-modified-since-system-was-booted-433467/)

Mike144 04-09-2006 05:51 PM

find and list files modified since system was booted
 
Hello

First time for me here.

I am having a problem finding and listing all of the files that have been created or modified in the /tmp directory since the system was last booted.

I know how to use the find command for a certain date or time but what command would I use to find and display the files since the last boot?

I need to setup a shell script with the command in it for a class assignment.

Thanks in advance.

leonscape 04-09-2006 06:11 PM

uptime will tell you how long the system has been running. You can access /proc/stat as well to get the boot time which maybe easier to parse in your script. dpending on how your doing it.

Mike144 04-09-2006 06:20 PM

Thanks for the quick reply leonscape.

The problem is I don't know how to do it. The section of the assignment deals with the find command...here is the exact wording..

Heading of the section: Research on your Fedora Core 4 system to come up with sets of commands to accomplish the following tasks:

Here is the problem I'm having...

A listing of all files under the /tmp directory and it's sub directories that have been created or changed since the system was booted.

How I'm doing it is I'm not..I'm stuck. Any kick in the right direction would help. Better yet if you know of the simpliest way...I'll take that too.

Thanks again for your help.

gilead 04-09-2006 07:44 PM

I'd suggest typing man find and searching for atime, ctime and mtime. I'd also suggest man uptime and man last (hint search for -x).

Then I'd search google with something like atime ctime mtime and have a look at sites like http://www.brandonhutchinson.com/ctime_atime_mtime.html to see what the terms mean.

Lastly, I'd suggest reading the forum rules about asking for specific help with homework... ;)

leonscape 04-09-2006 07:57 PM

We need to calculate the number of minutes the system has been up, and feed that info to find.

Code:

#!/bin/bash
read upt idt << READ
    $( cat /proc/uptime )
READ
upt=$((${upt%%.*}/60))

find /tmp -type f -amin -$upt


Mike144 04-09-2006 08:03 PM

Thank you both for your help.

As far as the homework issue.. oops! My frustration level exceeded my brains capacity.

I am trying to learn this stuff.. not just for homework but for a personal goal I set.

It took me 24 years to get back to school and my learning curve is a bit slow.

Thanks again for your help on this.


All times are GMT -5. The time now is 10:31 PM.