LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-30-2012, 11:07 AM   #1
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Rep: Reputation: 1
Loop


Hello,

I would to change the default tomcat directory from /var/www[...] to /mydirectory/mywebsite

i tried this to look for the config file contains "/var/www/index.html" with
this

Code:
find / -name index.html -exec grep "/var/www/index.html" {} \;
but the output is

Code:
find: File system loop detected; "/var/named/chroot/var/named" is part of the same file system loop as "/var/named".
i tried to remove "var" directory under chroot but device is busy

What is that?
 
Old 10-30-2012, 11:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
it's a chroot jail for bind. Adding a -H to the find command will stop that, but a better way is to not search the entire system in the first place.
 
Old 10-30-2012, 11:40 AM   #3
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Original Poster
Rep: Reputation: 1
Code:
[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
 
Old 10-30-2012, 11:54 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
it's a symbolic link.
 
Old 10-30-2012, 12:00 PM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
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:
Code:
find / -name "index.html" -exec ls -la {} \; | grep <filename-you're-searching>

Last edited by shivaa; 10-30-2012 at 12:05 PM.
 
Old 10-30-2012, 12:15 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Quote:
Originally Posted by shivaa View Post
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:
Code:
find / -name "index.html" -exec ls -la {} \; | grep <filename-you're-searching>
he's searching for text INSIDE it. It's the -name option that makes it not work, not the grep.
 
1 members found this post helpful.
Old 10-30-2012, 01:21 PM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by acid_kewpie View Post
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?

Last edited by shivaa; 10-30-2012 at 01:28 PM.
 
1 members found this post helpful.
Old 10-30-2012, 02:50 PM   #8
adol83
Member
 
Registered: Jul 2012
Location: Rome
Distribution: RHEL6, CentOs
Posts: 92

Original Poster
Rep: Reputation: 1
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.
 
  


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
how to loop over text file lines within bash script for loop? johnpaulodonnell Linux - Newbie 9 07-28-2015 04:49 PM
[SOLVED] Bash - While Loop reading from two lists simultaneously - nested while loop wolverene13 Programming 11 10-01-2011 06:00 PM
for loop or while loop to read the fields of a file.. visitnag Linux - Newbie 10 09-02-2010 09:47 PM
bash loop within a loop for mysql ops br8kwall Programming 10 04-30-2008 04:50 AM


All times are GMT -5. The time now is 04:31 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration