I use cat -n to get a line listing of the content in a .txt file.

[$] cat exam.txt                                                                                                                    
     1  let's see how far does this go, and if it works or not. if not till where it 
     2  goes and what happens after that. In nano, things are much more better than in X 
     3  text editors as there is no set fill therein as there is in nano and hence are 
     4  much worse off. 

In dpkg there doesn't seem to do that, or is there ? I am on Debian testing and running dpkg 1.18.18 . Just to make the listing less cumbersome, am using head -

[$] dpkg -L nano | head


Because I'm using head I know these are 10 lines or 10 files, considering . as a file as well. I did try something like -

$ dpkg -nL nano 

But got the error it doesn't know that option.

If it's not possible, please let me know so I can file it as a feature-request in dpkg.

dpkg -L nano | cat -n

does the trick... (It counts directories as well as files though.)

If you just want the total,

dpkg -L nano | wc -l
  • 2
    Another application that does line numbering and is in coreutils is nl. – Wieland Jan 24 '17 at 19:29
  • you meant nl it was reading as 1. – shirish Jan 24 '17 at 19:37

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.