- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - HP-UX
- >
- Languages and Scripting
- >
- Re: find command
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
- 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
- Email to a Friend
- Report Inappropriate Content
10-06-2011 09:02 AM
10-06-2011 09:02 AM
The cmd:
find / -exec ls -l {} \;
will provide the output I'm looking for, but if I want to send output to screen AND a file OR just to a file, what would that syntax be?
Thx in advance...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-06-2011 09:09 AM
10-06-2011 09:09 AM
Solution
@john guardian wrote:
find / -exec ls -l {} \;
will provide the output I'm looking for, but if I want to send output to screen AND a file OR just to a file, what would that syntax be?
Hi:
Use 'tee' to send the ouput to your terminal and a file:
# find / -exec ls -ld {} + | tee /var/tmp/myoutput
Notice that I also changed your 'ls -l' to 'ls -ld'. THis is because you will do an 'ls -l' on *both* files and directories otherwise leading to duplicated output.
Notice too that the '\;' terminator for '-exec' means that you spawn one process for every argument! This will really drag your perfomance down. Using '{} +' causes mutiple arguments to be assembled for every process instantiation. This is akin to using 'xargs' and greatly improves performance!
Regards!
...JRF...
- Tags:
- tee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-06-2011 02:15 PM
10-06-2011 02:15 PM
Re: find command (redirection)
>if I want to send output to screen AND a file OR just to a file, what would that syntax be?
Why? You just redirect the output to a file and put the find(1) in the background and do something else. If you are thinking about using tee(1), don't.
find / -exec ls -ld {} + > find-output 2>&1
Then you can use "tail -f" or other commands while it is working.
>This is akin to using 'xargs' and greatly improves performance!
It is orders of magnitude better than xargs(1), assuming large start up costs as with ll(1).
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP