DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Mac OS X UNIX Tip-of-the-Day   back to index

Week 102 - Unix Commands Reference II (21 March 2005)

by Adrian Mayo - Editor, OSXFAQ

Monday - Commands to Search for Files

Last week and the next three weeks will form a Unix command reference by listing lots of commands under specific areas of usage. There are so many commands available that it is impossible to know them all, or even remember all those one knew and used just last month.

See the rest of the tips for lots of example usage of these commands.

See the Learning Centre for tutorials on these commands, and explanations of Unix permissions.

And of course, don't forget the Unix manual 'man'.

To search for files in the files system, use:

find ... find files matching a number of criteria
Option -E to specify extended regular expressions
Option -L to follow symbolic links for found files
Option -X when find is used with xargs
Option -s to search hierarchies in lexicographical order

Check out the many primaries, which specify which files are matched based on many, many criteria such as name, time/date, owners, size, type, permissions, etc
(See tips weeks 1, 13, 31, 49, 97, 98)

locate ... search a database of files
This relies on the locate database being up to date
(See tips week 1)

locate.updatedb ... update the locate database in
(See tips week 1)

The best way to update the locate database database to avoid revealing private filenames is by the command:
$ sudo periodic weekly

(See tips weeks 64, 88)

type ... find an executable (bash shell only)
Option -a to find all versions of the executable
(See tips week 77 - Tuesday)

which ... find an executable (csh and tcsh)
(See tips weeks 20 and 47 - Monday)

whereis ... find an executable (search system path)

Also:

ls -r * ... recursive directory listing

echo * ... list all files in the current directory


Discuss this trick in the Learning Center forum


If you want to learn more about Mac OS X Unix visit the Learning Center  click.

  • For beginners: Mac OS X Unix Tutorials
  • For detailed information on specific topics: Advanced Unix
  • For OS X in gereral: Mac OS X Tutorials

Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.