When I type:

whereis boost

it shows:


Now I want to list all the files in this directory, so I type:

whereis boost | ls

But it only shows the files in the current working directory. Is there anyway to list all the files more quickly following the idea above (the way can be different but the idea is I want to quickly have a glimpse at a directory which I find with whereis, locate or something like that).

  • @LongHDi The first item listed on How to Ask is a suggestion that you first thoroughly search for an answer before posting here. This could (should) include reading relevant manuals, though I don't think we could reasonably expect you to know to look in sh(1) if you're new. Command substitution is the answer, but I'm going to casually mention xargs
    – Fox
    Commented May 10, 2017 at 8:28

1 Answer 1


ls doesn’t take its arguments from its standard input (which is how a pipe passes data into a process), but from its command line.

ls $(whereis boost)

will take the output of whereis boost and use it as arguments for ls, giving the result you’re after. This is known as command substitution.

  • Thank you! I have very little experience with Linux command line so I hadn't known the command substitution until you showed me.
    – Long HDi
    Commented May 10, 2017 at 7:06

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