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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[root@machine mydirectory]# find -H / -name index.html -exec grep "/var/www/index.html" {} \;
find: File system loop detected; "/var/named/chroot/var/named" is part of the same file system loop as "/var/named".
I understand not searching for the whole file system, though, i wish to understand what that system loop is
I don't understand the way you're using find cmd. You're searching for a file named "index.conf", then using a grep to filter "/var/www/index.html" from it.
In cmd that you used, find will get a list of files matching the specified pattern, and that will contain file names only, but not their full paths i.e /var/www/index.html, so using grep "<full-path-of-file> won't help you. Using grep directly is not a right way, but instead of this, you can use following cmd:
I don't understand the way you're using find cmd. You're searching for a file named "index.conf", then using a grep to filter "/var/www/index.html" from it.
In cmd that you used, find will get a list of files matching the specified pattern, and that will contain file names only, but not their full paths i.e /var/www/index.html, so using grep "<full-path-of-file> won't help you. Using grep directly is not a right way, but instead of this, you can use following cmd:
he's searching for text INSIDE it. It's the -name option that makes it not work, not the grep.
@Chris:- What's meaning of searching full path of file inside the file itself?
Perhaps he's trying to search the file named "index.html" in whole file system and then using grep to show that "index.html" file only (but in a incorrect way).
@adol83:- Can you clear the situation, what you're searching for, a file named "index.html" and then a word "/var/www/index.html" inside it OR searching for the "index.html" file only?
It worked out a little more as soon i took off the "-name" option. But it stucked after a couple of hour and i broke with CTRL+C
Anyway that was a research of some content inside the "index.html" file. My intention was to find "index.html" with exact content because i messed up tomcat installation and i have to recover the original "index.html" file i lost.
Furthermore, i took this research as exercise for practice the "find" option and passing arguments to that.
The fact is that "index.html" is a common file and you can find out several inside your system but i need the one i wrote "/var/www/index.html" inside.
I found out at last so it's not a problem anymore but that would become interesting to figure out a way for discover a common file but with a specific content.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.