Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
that works fine, but i have a directory .snapshot that is a major waste of time to traverse through. i want find to exclude it. there is an option of -prune but i cannot seem to get it to work without saying
paths must precede expression
did some searching but cannot find example of -prune on the net
i was able to use ! -name .snapshot to avoid the directory, but this still does not address the issue of how to use -prune effectively.
Last edited by scr-be; 03-26-2010 at 04:21 PM.
I believe the example in post #4 will still transverse the files in the .snapshot directory, even though the files in it will not be printed. Using prune, the directory will not be traversed, saving time if there are many files in the pruned directory. The find man page even says "To ignore a whole directory tree, use -prune..." in the paragraph describing -path.
find . -atime +360 | grep -v "snapshot" > find.no_snapshot.tmp
while read file; do
ls -alh $file
done < find.no_snapshot.tmp
If .snapshot was not so large, it would not be a big deal and this script would apply. As read this script would only parse out .snapshot/* after find has traversed it. In the environment I work with .snapshot contains at least 4 exact copies of the data set where it exists. They are time delayed local archives. So to traverse .snapshot would cause for at least 4 times the amount of files required for the desired results.