0

I can list all test.txt files on RHEL terminal using

sudo find / -iname 'list.txt' 

If there is a file /media/my/list.txt I can run

sudo ls -la /media/my/list.txt

to get the attributes. How can I pipe all results from the first command to the second command to see the attributes of all files from the first command?

2 Answers 2

3

You don't need a pipe.

Since you are using RHEL you probably have GNU find which (among others) provides a -ls action

sudo find / -iname 'list.txt' -ls

Otherwise, POSIXly

sudo find / -iname 'list.txt' -exec ls -l {} +
1
  • This is not about GNU find... find -ls has been introduced by SunOS-3.x in 1986 and find -exec + has been introduced by David Korn at AT&T in 1988. GNU find even was late with implementing this...
    – schily
    Feb 26, 2020 at 13:51
1

Try this

sudo ls -la $(sudo find / -iname 'list.txt' | xargs)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .