The new ParentDish: helping raise kids of all ages

Spotlight from the Command Line

0xFE (pronounced "254" I suppose...) has a very nice how-to up showing how to use Spotlight metadata to find files from the command line. The post shows how the mdfind command goes beyond find, locate and various grep hacks to create flexible and powerful queries. Surprisingly enough, I couldn't find an mdfind man page (mdutil was there) but the mdfind command worked fine for me in Terminal.

A typical mdfind command goes something like mdfind Sadun, where Sadun is the search word. To limit the search to a particular folder use the -only flag. mdfind -only ~/Desktop Sadun.

The mdls command displays the metadata associated with a specified file. e.g.

% mdls Television\ copy.jpg Television copy.jpg ------------- 
kMDItemAttributeChangeDate = 2006-11-29 11:10:52 -0700 kMDItemBitsPerSample
= 32 kMDItemColorSpace = "RGB" kMDItemContentCreationDate =
2006-11-29 11:10:19 -0700 kMDItemContentModificationDate = 2006-11-29
11:10:19 -0700 kMDItemContentType = "public.jpeg"
kMDItemContentTypeTree = ("public.jpeg", "public.image",
"public.data", "public.item", "public.content") kMDItemCreator
= "Adobe Photoshop CS2 Macintosh" kMDItemDisplayName
= "Television copy.jpg" kMDItemFSContentChangeDate =
2006-11-29 11:10:19 -0700 kMDItemFSCreationDate =
2006-11-29 11:10:19 -0700 (...and so forth...)

It's a great post that goes into far more detail and is well worth a careful read.

Related Headlines

TUAW Features


Mac 101 ask-tuaw
Mac News
WWDC (251)
.Mac (60)
Accessories (635)
Airport (75)
Analysis / Opinion (1333)
Apple (1645)
Apple Corporate (558)
Apple Financial (188)
Apple History (45)
Apple Professional (54)
Apple TV (160)
Audio (446)
Bad Apple (118)
Beta Beat (152)
Blogging (84)
Bluetooth (16)
Bugs/Recalls (56)
Cult of Mac (870)
Deals (216)
Desktops (115)
Developer (254)
Education (99)
eMac (10)
Enterprise (138)
Features (400)
Freeware (385)
Gaming (363)
Graphic Design (33)
Hardware (1281)
Holidays (37)
Humor (576)
iBook (65)
iLife (235)
iMac (184)
Internet (327)
Internet Tools (1313)
iTS (968)
iTunes (800)
iWork (22)
Leopard (367)
Mac mini (112)
Mac Pro (53)
MacBook (202)
MacBook Air (79)
Macbook Pro (220)
MobileMe (19)
Multimedia (443)
Odds and ends (1443)
Open Source (279)
OS (912)
Peripherals (208)
Podcasting (182)
Podcasts (90)
Portables (197)
PowerBook (135)
PowerMac G5 (50)
Retail (588)
Retro Mac (48)
Rig of the Week (42)
Rumors (632)
Software (4322)
Software Update (406)
Steve Jobs (252)
Stocking Stuffers (50)
Surveys and Polls (97)
Switchers (112)
The Woz (34)
TUAW Business (238)
Universal Binary (281)
UNIX / BSD (61)
Video (904)
Weekend Review (82)
WIN Business (47)
Wireless (84)
Xserve (39)
iPhone/iPod News
iPhone (1515)
iPod Family (2028)
App Store (27)
SDK (16)
Mac Events
One More Thing (27)
Liveblog (1)
Other Events (226)
Macworld (489)
Mac Learning
AppleScript (3)
Ask TUAW (102)
Blogs (85)
Books (26)
Books and Blogs (62)
Cool tools (443)
Hacks (460)
How-tos (485)
Interviews (44)
Mods (186)
Productivity (588)
Reviews (109)
Security (154)
Terminal Tips (58)
Tips and tricks (565)
Troubleshooting (167)
TUAW Features
iPhone 101 (27)
TUAW Labs (3)
Blast From the Past (17)
TUAW Tips (142)
Flickr Find (36)
Found Footage (82)
Mac 101 (90)
TUAW Interview (31)
Widget Watch (198)
The Daily Best (1)
TUAW Faceoff (4)

RESOURCES

RSS NEWSFEEDS

Powered by Blogsmith

Sponsored Links

The Unofficial Apple Weblog (TUAW) bloggers (30 days)

#BloggerPostsCmts
1Cory Bohon891
2Robert Palmer6444
3Steven Sande5822
4Scott McNulty400
5Mat Lu4010
6Dave Caolo370
7Erica Sadun282
8Brett Terpstra230
9Mike Schramm201
10Michael Rose1132
11Christina Warren1038
12Joshua Ellis32
13Lisa Hoover26
14Chris Ullrich22

Featured Galleries

Macworld 2008 Keynote
Macworld 2008 Build-up
Apple Vanity Plates
DiscPainter
Macworld Expo 2007 show floor
The Macworld Faithful in Line
iPhone First Look
AT&T 3G Coverage Map
MobileMe Guided Tour UI Changes

 

    Most Commented On (7 days)

    Recent Comments

    More Apple Analysis

    More from AOL Money and Finance

    Weblogs, Inc. Network

    Other Weblogs Inc. Network blogs you might be interested in: