Apple Mac OS X Server Network Card User Manual


 
26 Chapter 1 Executing Commands
Correcting Typing Errors
To correct a typing error before you press Return to execute the command, press Left
Arrow or Right Arrow to skip over parts of the command you don’t want to change,
press the Delete key to remove characters, enter regular characters to insert them, and
finally press Return to execute the command.
To ignore what you have entered and start again, press Control–U.
Repeating Commands
To repeat a command, press Up Arrow until you see the command, make any
modifications, and then press Return.
Including Paths Using Drag and Drop
To include a fully qualified filename or folder path in a command, you can drag and
drop the folder or file from a Finder window into the Terminal window.
Searching for Text Within a File
To locate a unique string within a file, use the grep tool. The grep tool searches the
named input files for lines containing a match to the given pattern. By default, grep
prints the matching lines.
To search for a unique string in a file:
$ grep
sunshine
filename
where filename is the name of the file you wish to search through and sunshine is the
unique string.
Commands Requiring Root Privileges
Many commands used to manage a server must be executed by the root user. If you
get a message such as permission denied, the command probably requires root
privileges.
To execute a single command as the root user, begin the command with sudo (short for
super user do). For example:
$ sudo serveradmin list
You’re prompted for the root password if you haven’t used sudo recently. The root user
password is set to the administrator user password when you install Mac OS X Server.
To switch to the root user so you don’t have to repeatedly enter sudo, use the su
command:
$su root
You’re prompted for the root user password and then are logged in as the root user
until you log out or use the su command to switch to another user.