Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Listing Files
axero
post Oct 22 2003, 09:28 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 22-October 03
Member No.: 1,676



How can you list all the files under the /home directory that have been created or modified since the last system boot?

I checked the man pages for find but cant seem to find a way to do it, any ideas?

Thanks.
Go to the top of the page
 
+Quote Post
hughesjr
post Oct 23 2003, 06:36 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



The first thing you need to do is find a file that is created at startup, so you can compare files to that file and list any files that are newer than that file. There are any number of files that probably meet that condition. I use RedHat and when things in the /etc/init.d directory are started they write files in a directory called:

/var/lock/subsys

Right now, I have 26 files in that directory that were created on Oct 20 20:07. I would pick a file that I know I never restart, but that will run everytime the machine is started. One such file (on my system) is /var/lock/subsys/atd. atd is used to run files at a given time ... it starts on bootup and I never restart it during normal operations ... so that is the file I will use to test all the files in home against...

That file {/var/lock/subsys/atd} is very distro {RedHat} and machine {I use atd, other may not} dependant, but the concept is find a file that is created (or changed) at boot up and doesn't normally change until the next boot up. Another file (on a RedHat machine) that you can use is /var/log/boot.log...it is a log of bootup output, and is rewritten every machine start. In fact, I like it better, so I've talked myself into using /var/log/boot.log.

The command would be:

find /home * -newer /var/log/boot.log

That would show all files and directories ... if you only wanted files, the command would be:

find /home * -type f -newer /var/log/boot.log

If you wanted to write the results to a file for viewing ... it would be like this (to write to the user's home directory in a file named files_changed.txt:

find /home * -type f -newer /var/log/boot.log > $HOME/files_changed.txt

(putting the * in means that only files that start with something other than . will be shown .... if you also want to see the . files (like .bashrc or .bash_profile) then just use the command like this:

find /home -type f -newer /var/log/boot.log > $HOME/files_changed.txt


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th October 2017 - 09:42 AM