- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Find command help
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
тАО12-01-2009 12:34 PM
тАО12-01-2009 12:34 PM
I am using find command to files with unknown UID/GID on HP-UX server. Below is part of the code that I am using:
case "$OSNAME" in
HP-UX) print "Finding unknown files"
find / -path "/var/spool/cron/atjobs" -prune -o \
-path "/dev" -prune -o \
\( -fsonly vxfs -o -fsonly hfs \) \
\( -nouser -o -nogroup \) -print | xargs ls -ls
And I am reading the output
cat /var/adm/issuance/find.log | mailx -s
The problem is the ls -ld is actually doing the ls -ld on the /var/adm/issuance rather than the find command.
Please help!
Thanks.
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2009 12:47 PM
тАО12-01-2009 12:47 PM
SolutionYou're making this much harder than it needs to be. I would simply use:
# find / \( -nouser -o -nogroup \) -exec ls -ld {} +
...since most filesystems are VxFS ones anyway. If you like, though:
# find / \( -nouser -o -nogroup \) -a \( -fstype vxfs -o -fstype hfs \) -exec ls -ld {} +
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2009 01:13 PM
тАО12-01-2009 01:13 PM
Re: Find command help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2009 03:17 PM
тАО12-01-2009 03:17 PM
Re: Find command help
I should add that if you truly want to skip (for example, the '/dev' directory) you could do:
# find / ! -path "/dev/*" \( -nouser -o -nogroup \) -exec ls -ld {} +
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2009 07:39 PM
тАО12-01-2009 07:39 PM
Re: Find command help
find / ! -path "/dev/*"
These are not the droids you are looking for. :-)
This doesn't "skip" files but simply doesn't print them.
The correct primary is the hard to understand and poorly documented "-prune", which stops descending the directory tree.
find / -name /dev -prune -o \( -nouser -o -nogroup \) -exec ls -ld {} +
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1276654
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1322635
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1309998
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1303248
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-02-2009 06:14 AM
тАО12-02-2009 06:14 AM
Re: Find command help
> Dennis: The correct primary is the hard to understand and poorly documented "-prune",
Yes, that's an understatement :-)
> Dennis: find / -name /dev -prune -o \( -nouser -o -nogroup \) -exec ls -ld {} +
No, this should be a simple, single directory name without leading or embedded slashes:
find / -name dev -prune -o \( -nouser -o -nogroup \) -exec ls -ld {} +
Regards!
...JRF...