- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find command
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
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
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
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
- 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
- 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).