LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-24-2008, 11:56 AM   #1
incomingid
LQ Newbie
 
Registered: Oct 2008
Posts: 15

Rep: Reputation: 0
Have a few questions about displaying files


MY questions:

1) Display a list of all the files under the /etc directory and its sub-directories that have been created or modified within the last 60 minutes.

2) Display a list of all the files under the /var directory and all its sub-directories that have been created or modified today (since mid-night).

3) Display a list of all the files under the /home directory and all its sub-directories that have been created or modified within the last 8 days.

4) Display a list of all the files under the /tmp directory and all its sub-directories that were more than 15 days old

I count find answer for those questions.
 
Old 10-24-2008, 12:37 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,520

Rep: Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944
Quote:
Originally Posted by incomingid View Post
MY questions:

1) Display a list of all the files under the /etc directory and its sub-directories that have been created or modified within the last 60 minutes.

2) Display a list of all the files under the /var directory and all its sub-directories that have been created or modified today (since mid-night).

3) Display a list of all the files under the /home directory and all its sub-directories that have been created or modified within the last 8 days.

4) Display a list of all the files under the /tmp directory and all its sub-directories that were more than 15 days old

I count find answer for those questions.
Google for "atime", "mtime", and "ctime". This page can help you

http://dsl.org/cookbook/cookbook_10.html
 
Old 10-24-2008, 12:41 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Homework??

I would start with "man find" (enter this in a terminal)
 
Old 10-24-2008, 02:42 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Definitely homework and someone too lazy too use the tools available.

I would suggest that you look at 'man ls', 'man ctime' and 'man find'.

Plus look at the next links;
 
Old 10-25-2008, 02:00 AM   #5
incomingid
LQ Newbie
 
Registered: Oct 2008
Posts: 15

Original Poster
Rep: Reputation: 0
I am not lazy. I finished more then half of the assignment myself. But some of the questions I cant find. The assignment contains 38 questions and all of them are research questions ( not thought in class). I just need some help with some of the questions. Its not about me being lazy. I am not trying to use anyone in a rude manner. I am sorry if I have u the wrong impression.

Last edited by incomingid; 10-25-2008 at 02:03 AM.
 
Old 10-25-2008, 02:33 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Well, how about some extra credit! Download the source packages for "findutils" and "coreutils". Generate the "Finding Files" and "Core Utils" pdf or dvi manuals and print them out. The coreutils manual has instructions on about 100 commands. Most of them are basic commands like cp and mv. Having it in a book format can help you learn these commands easier and remember them. You can resort to the printout while trying many of them out. Some of the commands like "comm" and "dd" are real gems. Some commands like "tsort" you will probably never use, but other like "tee".

The find command finds files based on criteria that you indicate. It is like a swiss-army-knife. You can find all of the suid programs on your system and see which ones you could uninstall. You can select by size, date, timestamp or name pattern, combining them, and even do something with the results. You can also print out the results in different ways, such as the name, inode, size, ownership.

Also look at the xargs command. Find and xargs are often used together to be able to handle very large result sets. If you have 30,000 files in a directory, wildcards may choke bash with too many arguments. find piped to xargs is a solution you will run into in the future.

Good Luck.
 
Old 10-25-2008, 10:30 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Quote:
Originally Posted by incomingid View Post
I am not lazy. I finished more then half of the assignment myself. But some of the questions I cant find. The assignment contains 38 questions and all of them are research questions ( not thought in class). I just need some help with some of the questions. Its not about me being lazy. I am not trying to use anyone in a rude manner. I am sorry if I have u the wrong impression.
Then you should have formed your post a little better (How to Ask Questions the Smart Way). If you had formed it with the taste of the last then you may have gotten more assistance initially.

Good that you have finished at least part of the assignment. If you are having problems with specifics then these should be addressed to your prof/instructor/teacher first. That way he/she can see where the attention is actually necessary. I come from academia and knowing a students weakness or strengths was important so that we could form a means that would really work. Any teacher would not criticize a student that is duly trying to accomplish a task(s). Most would welcome the opportunity to teach that person.

The challenge that we presented was somewhat of a test too. You should see the number of homework type questions here on LQ. Most people will help someone who is attempting to help themselves.

I'm sure that your assignment has support documentation or instructions as to where to reference or where the instructor may example your assignment support. The questions you presented in the original post are general so the tasks do build on each other in a sense, 'jschiwal' has given you a good lead so I suggest that you use it.

I would add that 'Advanced Bash-Scripting Guide' is a good reference for you too look at and have as support documentation. Along with 'Linux Newbie Admin Guide', 'Linux Command Guide' and 'Learning the Shell' you should be able to understand a little better. Just remember the hardest thing is going to be is too breaking down your assignment to the simplest terms and to tackle those terms outwardly.
 
Old 10-25-2008, 02:36 PM   #8
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Seems like "watch" might work to track updated files in /etc directory.
 
Old 10-31-2008, 11:15 AM   #9
incomingid
LQ Newbie
 
Registered: Oct 2008
Posts: 15

Original Poster
Rep: Reputation: 0
Ty for your help. I found the answer

find /etc -mmin +60
find /var -daystart
find /home -mtime -8
find /tmp -mtime +15


Now I just have to hope its the right answer :>a

Thanks again.
 
Old 11-01-2008, 08:59 AM   #10
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Isn't there an error in the first solution?
shouldn't that be -60? (Per the original Post)

Last edited by john test; 11-01-2008 at 09:12 AM.
 
Old 11-03-2008, 11:03 AM   #11
incomingid
LQ Newbie
 
Registered: Oct 2008
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by john test View Post
Isn't there an error in the first solution?
shouldn't that be -60? (Per the original Post)

When i use +60 it gives me a long long log.
When I use -60 it gives me a shorter long. So I'm guessing -60 is the right answer. Thank you for pointing that out.
 
Old 11-03-2008, 11:24 AM   #12
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
You are very welcome.
 
  


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
Displaying .sh files within firefox jong357 Slackware 10 02-07-2008 09:35 AM
[SOLVED] displaying these two files vikas027 Programming 2 10-28-2007 08:46 AM
Displaying certain parts of files tardigrade Linux - General 7 01-14-2006 01:58 PM
help! konqueror not displaying files as root! blue.spark Linux - Software 6 06-02-2005 05:52 AM
Konqueror not displaying files El Basto Linux - Software 4 12-31-2004 10:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:29 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
Open Source Consulting | Domain Registration