This section briefly describes a few of the many utilities that can help you perform system administration tasks. Read the man/info pages for these utilities to learn more about using them. Some of these utilities are useful to users other than the system administrator.
Changes the login shell for a user. When you call chsh without an argument, you change your own login shell. Superuser can change the shell for any user by calling chsh with that user's username as an argument. When changing a login shell with chsh, you must specify an installed shell that is listed in /etc/shells. OS X rejects entries that are not in this file. Also, you must give the pathname to the shell exactly as it appears in /etc/shells. In the following example, Superuser changes Max's shell to tcsh:
#chsh -s /bin/tcsh max chsh: netinfo domain "." updated
The s option allows you to specify the pathname of the new shell. If you do not specify a new shell, chsh opens an editor showing the account features you are allowed to change. Change the pathname adjacent to Shell:, write the file to disk, and exit from the editor to change the login shell.
Clears the screen. You can also use CONTROL-L from bash to clear the screen. The value of the environment variable TERM (page 913) determines how to clear the screen.
Formats and partitions disks (page 712).
Displays recent system log messages (page 717).
Manipulates disk images; comparable to diskutil.
Sends instructions to launchd. You can use this utility to start system services or change their settings (page 765).
newfs newfs_hfs newfs_msdos
Creates a new filesystem. Each of these utilities builds a a different type of filesystem. The newfs utility builds a UFS filesystem and works on either a hard disk partition or a floppy diskette. The following command builds a UFS filesystem on the device at /dev/disk0s3:
# newfs /dev/dsk0s3
Substitute the pathname of the device you want to create the filesystem on for /dev/disk0s3. Use newfs_hfs to create an HFS filesystem and newfs_msdos to create an MS-DOS filesystem. The following command creates an MS-DOS filesystem on the device at /dev/disk1s7:
# newfs_msdos /dev/disk1s7
Although these utilities accept various options and arguments, none are required. The diskutil utility (page 712) offers a different interface to the same functionality.
Sends packets to a remote system. This utility determines whether you can reach a remote system through the network and the time it takes to exchange messages with the remote system. Refer to "ping: Tests a Network Connection" on page 405.
reset (link to tset)
Resets terminal characteristics. The value of the environment variable TERM (page 913) determines how to reset the screen. The kill and interrupt characters are set to their default values and character echo is turned on. The reset utility is useful for restoring the screen to a sane state after it has been corrupted. Similar to an stty sane command.
Displays and alters kernel variables. You can alter some kernel options and limits by modifying variables using this utility. For more information see page 858.
A shell builtin that specifies the mask that the system uses to set access permissions when you create a file. See umask on page 883 for more information.
Displays information about the system. Without any arguments, uname displays the name of the operating system (Darwin). Giving uname a a (all) option causes it to display the operating system name, the hostname, the version number and release date of the operating system, and other information:
# uname a Darwin localhost 8.0.0 Darwin Kernel Version 8.0.0: Sun Feb 13 18:22:16 PST 2005; root:xnu- 756.2.obj~2/RELEASE_PPC Power Macintosh powerpc
The rpcinfo utility can display information about programs registered with portmap and can make RPC calls to programs to see if they are alive. For more information on portmap, refer to "RPC Network Services" on page 417. The rpcinfo utility takes the following options and arguments:
rpcinfo p [host] rpcinfo [n port] u \ t host program [version] rpcinfo b \ d program version
probe Lists all RPC programs registered with portmap on host or on the local system if host is not specified.
(port) number With t or u, uses port port in place of the port number specified by portmap.
UDP Makes a UDP RPC call to version (if specified) of program on host and reports whether there was a response.
TCP Makes a TCP RPC call to version (if specified) of program on host and reports whether there was a response.
broadcast Makes an RPC broadcast to version of program and lists hosts that respond.
delete Removes local RPC registration for version of program. Can be used by Superuser only.
Give the following command to see which RPC programs are registered with the portmap daemon on the system named peach:
$ /usr/sbin/rpcinfo -p peach program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100024 1 udp 32768 status 100024 1 tcp 32768 status 100021 1 udp 32769 nlockmgr 100021 3 udp 32769 nlockmgr ...
Use the u option to display a list of versions of a daemon, such as ypserv, registered on a remote system (peach):
$ /usr/sbin/rpcinfo -u peach ypserv program 100004 version 1 ready and waiting program 100004 version 2 ready and waiting
Specify localhost to display a list of versions of a daemon registered on the local system:
$ /usr/sbin/rpcinfo -u localhost nfs program 100003 version 2 ready and waiting program 100003 version 3 ready and waiting
The portmap daemon is not needed for Apple's native file-sharing protocols. It is started automatically if you enable a service that uses it, such as NFS. Otherwise, it is not started.
Tip: Set the clocks
The portmap daemon relies on the client's and the server's clocks being synchronized. A simple DoS attack (page 931) can be initiated by setting the server's clock to the wrong time.