Get Number of PDF Pages in Terminal How can I output the number of pages in a PDF in the Terminal? I looked into the lp family of commands, with no luck however.
Using Apple's mdls:

 mdls -name kMDItemNumberOfPages file.pdf


to get just the number of pages:

 mdls -name kMDItemNumberOfPages -raw file.pdf