Skip to Content

Make smart financial decisions with DailyFinance
AOL Tech

Filed under: UNIX / BSD, Terminal Tips

Monday man page: ls

There are two kinds of Mac folk: them that finds this "Terminal" thing strangely fascinating, and them what considers it the worst kind of wicked magic, not to be trifled with. Here at TUAW we've got all kinds, and for anyone who might be curious about the power and possibilities of the command line, we're going to provide some weekly quick tips and suggestions for introductory use. Always keep in mind, though, that the damage you can do from Terminal is effectively unlimited, especially with administrative access. Best to play around in a 'dummy' account until you have your sea legs.

Even before we start, an explanation of the title: 'man pages' are the BSD UNIX manuals, already tucked away on your Mac. You can type "man command" in Terminal for a detailed (not to say overwhelming) rundown on any command-line tool. As we've mentioned before, an excellent intro to Terminal in Tiger can be found over at the O'Reilly Mac Dev Center. We also posted about Unix for the Beginning Mage, an amusing beginner's guide to the plumbing under Mac OS X.

Our fine feathered friend today is 'ls' -- the UNIX directory list command. Read on for more...
The 'ls' command will, in basic form, list the contents of a directory. Type 'ls ~/Desktop' sans quotes in Terminal, and get a readout of the files on your Desktop:
Last login: Mon Dec 18 00:02:44 on ttyp1
Welcome to Darwin!
MTR-iMac-242:~ miker$ ls ~/Desktop
Desktop 20060904 MacHeist ?? Bundle Receipt.pdf
Desktop 20061217 TuneTalk.JPG
"Cool beans," you say, "but can't I do that from the Finder?" Yes; but with some options, 'ls' can:
  • list ALL the files in a directory: 'ls -a ~/Desktop' -- great for finding mystery files; C.K. posted about this a while back
  • give a detailed readout including permissions: 'ls -l' -- or combine with above for all the invisibles and all the permissions: 'ls -la'
  • see the otherwise-hard-to-find ACLs for a directory or file: 'ls -e'
  • sort the file list by modification date, most recent first: 'ls -t'
For the full man page on 'ls' check out the HMUG listing or simply type 'man ls' at the Terminal prompt. It's worth mentioning that 'ls' (unlike some other commands we could mention) is completely nondestructive, so don't panic.

Reader Comments (Page 1 of 1)

Tip of the Day

To find out what version of Mac OS you are running, go to the Apple logo in the top left corner, click it and choose About This Mac. From that window you will see the version number, processor, memory and chosen startup disk. Clicking Software Update will check for updates, and More Info... will open up an extensive list of everything on your machine.


Follow us on Twitter!
TUAW [Cafepress]

Sponsored Links

Featured Galleries

DNC Macs
Macworld 2008 Keynote
Macworld 2008 Build-up
Google Earth for iPhone
Podcaster
AT&T Navigator Road Test
Bento for iPhone 1.0
Scrabble for iPhone
Tom Bihn Checkpoint Flyer Briefcase
Apple Vanity Plates
Apple booth Macworld 07
WorldVoice Radio
Quickoffice for iPhone 1.1.1
Daylite 3.9 Review
DiscPainter
Mariner Calc for iPhone
2009CupertinoBus
Crash Bandicoot Nitro Kart 3D
MLB.com At Bat 2009
Macworld Expo 2007 show floor
Apple Texas Hold 'Em

 

More Apple Analysis

AOL Radio TUAW on Stitcher