Specifications
Chapter 5 Common Command-Line Tasks 41
Key Command Action
J or Down Arrow Scroll down a line
K or Up Arrow Scroll up a line
N Find the next occurrence of a search term
P Find the previous occurrence of a search term
Q Quit
less
For more information about the less command, see its man page.
Searching for Text in a File
To locate a string within a le, use the grep tool. The grep tool searches the named
input les for lines containing a match to the given pattern. By default, grep prints the
matching lines.
To search for a unique string in a le:
$ grep search_string filename
Replace search_string with the the string to search for, and replace lename with the
name of the le whose contents you want to search.
Backing Up and Restoring
Time Machine is extremely useful for user backups, but server administrators might
have dierent backup requirements. Mac OS X Server provides several command-line
tools for backing up and restoring data:
 rsync—Use this command to keep a backup copy of your data in sync with the
original. rsync copies only the les that have changed.
 ditto—Use this command to perform full backups.
 asr—Use this command to back up and restore an entire volume.
For more information about these commands, see their man pages.
Note: You can use these commands with the launchctl command to automate
data backup.