0

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?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • 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

1 Answers1

4

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

ldconfig -p | head -n 20 > ex4-2-4a.txt
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255