Searching and Sorting

You can use the following tools to search and sort files.

egrep

Extended version of grep.

fgrep

Searches files for literal words.

find

Searches the system for filenames.

grep

Searches files for text patterns.

locate

Faster version of find; however, it depends on a database that is periodically updated by the weekly cron job in /etc/weekly. If the database is out of date, find is more accurate.

sort

Sorts a file (use -n for numeric sorting, -u to eliminate duplicates).

strings

Searches binary files for text patterns.

uniq

Reports or filters duplicate lines in a file.

zgrep

Searches compressed files for text patterns.

Get Mac OS X Panther for Unix Geeks, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.