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.
If you've got locate/slocate/mlocate on your system you can also type:
Locate is typically faster than find over a large structure, but requires you to generally crontab the updatedb program to run daily/weekly/monthly... and it's results are only as recent as the last time the updatedb ran.
I very seldom know the exact name of a file so I use "krusader" to do my file search. Just open krusader, go to "tools" in the top toolbar. Click on search. If the file name is "johnwenttotown" just type in john, on the second line type in"/" to search all. It will give you every file that starts with john and what directory they are in. If you click on it, it will take you to that file.
If you only know part of the filename you can use wildcards with find (piping find's output to grep is a less efficient way of doing the same thing). If it's an ordinary file (not a directory, a device file ...) then you can speed find along by specifying so. If you are not running the find as root then find will generate a lot of error messages when it can't enter directories; you don't need to see these because you can't reach any files in those directories. Combining all the above
find / -type f -iname '*foo*' 2>/dev/null
The single quotes around *foo* are required in case there are any files matching *foo* in the current directory.
Will find any file with .htm under /var/www and chown it to apache:apache and change the perms to 644. Then change every directory under /var/www to 755 and chown them to apache:apache also.
You can accomplish this with piping also but its generally far easier using the advanced structures of find... and for me personally, "-iname filename" or " | grep filename" I'll take the one with the lesser amount of typing, plus to make grep case insensitive you'd also have to add -i which makes it longer yet. Economy of typing.
Honestly though, that's one of the great things about unix, there are 10 different ways you can go about many tasks.