Re: combine two commands via pipe
On Fri, Jul 26, 2024 at 07:29:10 +0800, coreyh@free.fr wrote:
> On 2024-07-26 07:14, Alain D D Williams wrote:
> > Neither do you say what you are trying to achieve. Looking for files
> > owned by
> > apache in a directory ?
>
> yes.
Does "owned by apache" mean literally the user "apache"? Or is it really
the user "www-data"?
I'm going to assume you mean www-data.
This will give you the file and directory names:
find /tmp -user www-data
If you want more detail, add -ls to the end:
find /tmp -user www-data -ls
If you want the output to be sorted by the real ls(1), you have to
get a bit fancier. Here's one way, but it relies on the number of
pathnames being relatively small:
find /tmp -user www-data -print0 | xargs -0 ls -ldtr
If there are too many results, ls will be executed multiple times, and
then you'll get a series of separately sorted chunks, all concatenated
together.
I won't go any fancier than this until I know it's actually needed.
Reply to: