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. |
Quote:
http://dsl.org/cookbook/cookbook_10.html |
Homework??
I would start with "man find" (enter this in a terminal) |
|
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.
|
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. |
Hi,
Quote:
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. |
Seems like "watch" might work to track updated files in /etc directory.
|
Ty for your help. I found the answer :D
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. |
Isn't there an error in the first solution?
shouldn't that be -60? (Per the original Post) |
Quote:
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. |
You are very welcome.
|
All times are GMT -5. The time now is 07:43 PM. |