LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2003, 09:44 AM   #1
AoiSora
LQ Newbie
 
Registered: Oct 2003
Posts: 10

Rep: Reputation: 0
Command to list some files?


Hi guys! I am new in here, i got a question is have to

a listing of all the files under /etc/ directory, and its sub-

directories that have been created or changed since the system

was booted! even i have other question is modified in the last 60

mins, 7 days, and 30 days old.

Anyone can give me a concept which command should i use?

I try to use "ls" but, i don't think it's only this one!

Thanks!


Last edited by AoiSora; 10-29-2003 at 09:45 AM.
 
Old 10-29-2003, 09:49 AM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
"man find"

especially parameter -mmin and -mtime.
 
Old 10-29-2003, 09:51 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Use find together with a file that is created when booting. /var/log/boot.msg is one, but I don't know if all linux flavors use/create it. If you cannot find one, you can create a dummy file during boot and use that.

find /path/you/want -newer /var/log/boot.msg
 
Old 10-29-2003, 09:52 AM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
find /directoryyouwant -name \* -newer /etc/inittab

I used /etc/inittab - because it is created by booting.
You can also use -ctime or -mtime, etc.
 
Old 10-29-2003, 10:36 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
Quote:
Originally posted by jim mcnamara
I used /etc/inittab - because it is created by booting.
You can also use -ctime or -mtime, etc.
/etc/inittab created at boot time?!?
Not on my PC fortunately!
 
Old 10-29-2003, 10:39 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397


Neither on mine.
 
Old 10-29-2003, 10:46 AM   #7
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Then
Assume you booted today...

ll /etc | grep "Oct 29"
 
Old 10-29-2003, 01:08 PM   #8
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
Doesn't give me any file.
Some distribution may do strange things, but I would consider it weird for a system to create/touch a file somewhere in /etc. On debian I'd use /var/log/boot. If it's not on your system look for another file somewhere in /var, but not in /etc.
 
Old 10-29-2003, 02:00 PM   #9
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Some flavors of unix do write to /etc

And some will even give the boot time with

ll -d /

because the file mount rebuilds some directory components of the fs at boot time - old System V did that.
 
Old 10-29-2003, 02:10 PM   #10
AoiSora
LQ Newbie
 
Registered: Oct 2003
Posts: 10

Original Poster
Rep: Reputation: 0
how about.. setup the system so that the comman "mount /dev/mycd" will attached a Cd-ROM to the directory "/cdrom" ??

thanks
 
Old 10-29-2003, 02:23 PM   #11
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
The command
Code:
find /etc -mmin $(awk '{print "-"int($1/60+1)}' < /proc/uptime)
gives you files in /etc that have changed in your uptime.
 
Old 10-29-2003, 04:23 PM   #12
AoiSora
LQ Newbie
 
Registered: Oct 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by AoiSora
how about.. setup the system so that the comman "mount /dev/mycd" will attached a Cd-ROM to the directory "/cdrom" ??

thanks
please help on this !! ~~~
 
Old 10-29-2003, 04:34 PM   #13
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
Quote:
Originally posted by ToniT
The command
Code:
find /etc -mmin $(awk '{print "-"int($1/60+1)}' < /proc/uptime)
gives you files in /etc that have changed in your uptime.
Now that's a cool solution. Nice!
 
Old 10-29-2003, 04:37 PM   #14
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
Quote:
Originally posted by AoiSora
how about.. setup the system so that the comman "mount /dev/mycd" will attached a Cd-ROM to the directory "/cdrom" ??
Add this line to /etc/fstab :
Code:
/dev/mycd  /cdrom  iso9660  ro,user,noauto  0  0
If you only want root to be able to mount the cdrom, leave "user" out.

Last edited by Hko; 10-29-2003 at 04:39 PM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Command to select and move mutiple files from list in text file steve.paris Linux - Newbie 11 11-27-2005 12:44 PM
Command to run another command against a list of files psweetma Linux - General 3 11-09-2005 05:29 PM
Command Line Help: Remove a List of Files lukasbradley Linux - Newbie 2 08-17-2005 04:21 AM
Command to list total number of files. WillieB_72 Linux - General 3 01-29-2003 09:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:54 PM.

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