- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: find in root
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2007 11:14 PM
тАО04-23-2007 11:14 PM
find in root
I have a file which contains a list of filenames which i have to search in the whole filesystem (root /). I have used a script like
cat file|while read FILENAME
do
find / -name $FILENAME
done
But this is running damn slowly and i fear it may take years to complete this command.
Any one help me out plzzz
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2007 11:24 PM
тАО04-23-2007 11:24 PM
Re: find in root
What about:
# find / -xdev | grep -f file
rgds
HGH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2007 11:34 PM
тАО04-23-2007 11:34 PM
Re: find in root
find / -xdev -name $FILENAME
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2007 11:43 PM
тАО04-23-2007 11:43 PM
Re: find in root
find / -xdev -type f -name $FILENAME
(type f will only look for normal files)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-23-2007 11:44 PM
тАО04-23-2007 11:44 PM
Re: find in root
If you truly mean the whole file system, visting every mountpoint, then:
# find / -type f -name ...
...will do that AND potentially take a long time.
If you don't want to visit mountpoints then add the '-xdev' switch as noted:
# find / -xdev -type f -name ...
Notice that in either case I specified only *files* with the '-type f' argument. Drop that if you truly want both files and directories.
Lastly you can reduce the number of searches by doing something like:
# find / -xdev -type f -name myfile -o -name yourfile -o -name "her*" -o -name "his*"
That is, look for files by individual name and perhaps using wildcards. Be sure to quote the metacharacters so that the shell doesn't interpret them.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2007 12:56 AM
тАО04-24-2007 12:56 AM
Re: find in root
You may also consider breaking you code into several parts so that you can launch them in parallel.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2007 01:20 AM
тАО04-24-2007 01:20 AM
Re: find in root
find /home/some_user /var/tmp /tmp -name $FILENAME
If you are looking for a particular command, start with the man pages, then look in the system directories and application directories:
find /usr/bin /usr/sbin /use/lbin /usr/local /usr/contrib /opt/*/bin -name $FILENAME
A typical HP-UX system installation has several thousand files in several hundred directories, most of which you never need to search.
Is there a reason you need to look in every directory in the entire machine?
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2007 02:20 AM
тАО04-24-2007 02:20 AM
Re: find in root
1) Run find once and write the output to a temporary file - preferably with filters to restrict it to specific filesystems and to restrict it to regular files.
2) Scan this list of files using grep to find the matches.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2007 02:47 PM
тАО04-25-2007 02:47 PM
Re: find in root
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2007 03:29 PM
тАО04-25-2007 03:29 PM
Re: find in root
~hope it helps