I am trying to get the top 20 lines of ldconfig -p and piping them to a .txt file. I am doing the below syntax:

head -n 20 ldconfig -p > ex4-2-4a.txt

I am getting an error for invalid option for the -p. I can run ldconfig -p > textfile.txt and get an output, but the minute I put in the head it doesn't work. Any ideas?

  • Russ, did the answer below solve your problem? If so, please click the checkmark. Otherwise, let us know what went wrong. Thank you!
    – Jeff Schaller
    Apr 22 '18 at 14:24

head wants a text file or input to work with, not a command. Use:

ldconfig -p | head -n 20 > ex4-2-4a.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.