- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Find command exclude directories
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
Forums
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
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
тАО03-12-2008 01:16 AM
тАО03-12-2008 01:16 AM
Find command exclude directories
I'm trying to search for a file in the root directory that was created during the day. I have no idea what it is and the root filesystem is almost full.
How do I do a search only in the root directory excluding other filesystems etc: /etc /var ...
So my find command will be something like: find / -size +100 -mtime +1 ...?
Please who can help?
Schalk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 01:24 AM
тАО03-12-2008 01:24 AM
Re: Find command exclude directories
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 01:44 AM
тАО03-12-2008 01:44 AM
Re: Find command exclude directories
You may please explain bit more with your above answer ... I mean to say with one example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 01:44 AM
тАО03-12-2008 01:44 AM
Re: Find command exclude directories
I want to exclude certain directories, for instance if I run "find / -size +100 -mtime +1 -xdev /etc -exec ls -l {} \;" I still get: two problems
1) It finds files in /etc
2) I get very old files, whats wrong with my mtime?
Regards,
SChalk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 02:13 AM
тАО03-12-2008 02:13 AM
Re: Find command exclude directories
It is better to grep -v the result of find if you have anything complicated.
>find / -size +100 -mtime +1 -xdev /etc -exec ls -l {} \;
-xdev doesn't take a path.
You should also replace "\;" by "+" for performance.
You'll probably want to skip directories (-type f) or you'll need to change your "ls -l" to "ll -d".
>1) It finds files in /etc
That will happen if in the same file system as /.
>2) I get very old files, whats wrong with my mtime?
+1 is older than 1 day. You want -1.
>Davis: You may please explain bit more with your above answer
Not much to explain, look at find(1). Just add -xdev before the -exec.
I've also noticed that you seem to be checking the "Retain format" box. That doesn't make it easy to follow links:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1212050
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 02:20 AM
тАО03-12-2008 02:20 AM
Re: Find command exclude directories
with 'man find' you would get all informations you want.
'-xdev' is a stand-alone option to aviod 'find' to search across MOUNTED file systems. So if /etc, /var is mounted, it would be excluded.
To avoid find to search through certain directories use '-prune' - check the man pages of find with the examples how to use it.
Volkmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 02:24 AM
тАО03-12-2008 02:24 AM
Re: Find command exclude directories
Sorry, the command with /etc was the incorrect command I copied from my putty session. It was suppose to be without /etc
Thanks, the -1 option works.
Let me try to rephrase my question:
I want to find files everywhere under root but exclude directories /users, /etc, /var, /data ...
Hope this makes more sense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 02:31 AM
тАО03-12-2008 02:31 AM
Re: Find command exclude directories
so test:
find / -path ./etc -prune (or /etc -prune )
V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2008 03:02 AM
тАО03-12-2008 03:02 AM
Re: Find command exclude directories
try something like this:
# find / \( ! -path "/etc/*" \) -a \( ! -path "/users/*" \) -a \( ! -path "/data/*" \) -type f
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2008 04:54 AM
тАО03-13-2008 04:54 AM
Re: Find command exclude directories
I have an easy way to exclude /etc.
DONT.
Instead filter it off AFTER you got your list of files.
try this....
find / -xdev -mtime -1 -size +2000 -type f -print | grep -vE "^/etc" \ > /tmp/mybigoldfile.txt
You said the / file system is almost full. You can say you don't want to look at /etc, but I bet /etc is part of the / filesystem. So you should be looking there instead of ignoring it.
The option I really like is that -xdev. It excludes stuff that is on the filesystem you are looking at.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2008 05:26 AM
тАО03-13-2008 05:26 AM
Re: Find command exclude directories
Didn't I already say that? :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2008 05:29 AM
тАО03-13-2008 05:29 AM
Re: Find command exclude directories
If old files are there the delete that one.
or tar the files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2008 05:34 AM
тАО03-13-2008 05:34 AM
Re: Find command exclude directories
Yep. Sorry. I just didn't see it.
steve