APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

File listings from the command line

The OS X Finder suffers from a rather amazing limitation: you can't print the list of files you see in a Finder window. You can grab them and paste the list into something that can print, or you can do a screenshot and print that, but that's almost all.

Directory Content Printer is the one of only a few third party products I found - apparently this isn't seen as needed by many people!.

Another is Print Window. There is also PrintFinder.

Of course you can get quick printing from the command line. For some reasion, that suggestion is seen as unpleasant by most users. Even my wife, sitting not three feet from me, acts like I asked her to dig through the garbage when I suggest she open Terminal to do something.

It's not so horrible, really. Open Terminal (hit Command-Space for Spotlight and type "Terminal" if you have no idea what I mean), and try:


 ls | lp
 ls /Applications | lp
 ls ~/Documents | lp
 ls -l | lp
 ls -lR | lp
 ls -l | sort -r +4 | lp
 
 

That "|" thingy is called a "pipe symbol". It's the broken vertical bar produced by SHIFT-\. That's right, hold Shift and hit "\".

The "ls ~/Documents" says to list the "Doocuments" directory under your Home ("~") directory. An "ls ~Pictures" would list your Pictures.

Was that painful? There's a lot more you can do at the command line and none of it is really hard. Read some of the "Shell" articles here and particularly see Take Control of the Mac Command Line with Terminalfor more.

Don't neglect reading the "ls" man page if you aren't familiar with it; there are a lot of options for showing the files in different ways. You'd type "man ls" while still in Terminal to do that.

Why don't you print it? Type

man -t | lp
 

Or send it to Preview:

man -t ls | open -f -a /Applications/Preview.app/ 
 

I'm really surprised that there is still no way to do this from Finder. Maybe OS X will eventually address this, but printing from the command line will probably always have more power and flexibility.

`

Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> File listings from the command line

2 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Thu Sep 17 16:16:16 2009: 6925   BruceGarlock

gravatar
Although Cocoatech's PathFinder (link) is a bit bloated (runs a little slower than I would like) it generally fills in all the gaps that Apple's Finder has in it. I have been using it for a while now, and would recommend that people give it a try. Like I said, it feels a little bit bloated, but has just about every feature that you would want - including printing directory contents - and has a very in-depth way of customizing it for how you want things to work.

One of my favorite features, is the "Stacks". You drag files you want to copy to the "Stack", and you can then navigate to where you want the files to go, without jockeying windows around, and making a mess of your desktop.

I have recently added PathFinder to one of my "Top Ten Must have Mac Apps". I plan on writing a full blown article of my top ten for aplawrence.com - but I have two apps which I have been wavering with, and need to spend some more time with them to make sure they are worthy :-)



Thu Sep 17 16:20:29 2009: 6926   TonyLawrence

gravatar
What if you can't find ten? :-)

We're all looking forward to that - your app suggestions have been very useful.

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Doing linear scans over an associative array is like trying to club someone to death with a loaded Uzi. (Larry Wall)





This post tagged: