<<

. 36
( 69 .)



>>


The df command can also report on the creates a generous allocation of inodes. When
number of inodes allocated and used on your you type the command df -i, the system
file systems. While this may not be an issue on displays the number of inodes used as iused
your system, it is possible for a file system to and the number available as ifree. Unless
run out of inodes just as it is possible for a file the ifree value is extremely small, you are
system to run out of disk space. In either case, unlikely to have any problems. The ratio of
you cannot create new files until you solve inodes to disk space is usually set so that
the disk space or the inode issue. When you running out of inodes is nearly impossible.
first create a file system, the system also

TYPE THIS:

df -i
[ferro:˜]




RESULT:

Filesystem 512-blocks Used Avail Capacity iused ifree %iused Mounted on
/dev/disk0s 53545168 17462872 35570296 32% 2246857 4446287 33% /
devfs 201 201 0 100% 644 0 100% /dev
fdesc 2 2 0 100% 4 253 1% /dev
<volfs> 1024 1024 0 100% 0 0 100% /.vol




‹ Type * and press Return. ‹ Type sort -n and press
DISPLAY DISK USAGE DISPLAY DISK USAGE
IN KILOBYTES IN ORDER OF SIZE Return.
– The system displays the
„ Type du followed by a „ Type du -sk * followed by – The system displays the
sizes of your files and
space. a space.
directories. sizes of your files and
¤ Type -sk followed by a ¤ Type | followed by a directories in order of size.
space. space.
171
UNIX FOR MAC




MANAGE THE PRINT QUEUE
Some users request a printout of a document several times

Y
ou can use the lpq command to examine your print
in a row before checking to see if the reason that it does
queue and cancel print requests. This command also
not print is because there is no paper. When this happens,
lists print jobs that are waiting in the queue. As the
it is a good idea to cancel all but one of these print jobs.
printer handles each print request, the job disappears
Other users may print a document in the wrong format and
from the queue and the next job in line starts printing. The
end up printing a pile of paper that they cannot use.
cancel command cancels a selected print job, removing it
Canceling these jobs can save you both time and paper.
from the queue and leaving the remaining jobs to be
printed.
To submit a print job from the command line, you can use
the lpr command followed by the name of the file you
You have numerous reasons to examine a print queue and
want to print. Applications, such as Photoshop, also submit
to cancel jobs. For example, if you are waiting a long time
print jobs and these also appear in your print queue. You
for a printout, you can check the queue to see what other
can view all of the pending print jobs using lpq, whether
jobs are printing or should be printing. If the printer has
the print requests are generated by applications or the lpr
been out of paper for a while, you can view where your
command and regardless of who submitted each print
print job is in the queue, and decide whether to cancel
request.
the job.




MANAGE THE PRINT QUEUE




– The file queues for – The print queue displays.
¤ Type the name of a text
EXAMINE THE PRINT QUEUE
file, and press Return. printing.
„ Type lpr followed by a
‹ Type lpq and press
space.
Return.

172
11
SYSTEM ADMINISTRATION COMMANDS



If you need to cancel all of the jobs in a print queue, you can use the cancel
command with a -s argument. This command option saves you the time of
canceling jobs individually.
The Print Center is a useful tool for monitoring and controlling your printer; it
allows you to: determine the status of a printer; restart the printer; view the
jobs that are waiting to print; and determine whether the printer is active. If
the lpq command indicates that your printer is not ready, you can set it back
to operational status using the Print Center. To do this, double-click the name
of the printer that the lpq command tells you is inactive, and activate it again.
The Print Center is located in the /Applications/Utilities folder.

RESULT:
TYPE THIS:

lpq DESKJET_930C is ready and printing
[ferro:˜] user%
Rank Owner Job File(s) Total Size
active user 3 Chap11.txt 36864 bytes
1st user 4 oldhouse.jpg 919552 bytes


Each job in the queue has a rank, an owner, and a job number. To cancel a
job in the queue, use the command cancel followed by a space and the job
number.




¤ Type cancel followed by a ¤ Type status and press
CANCEL A PRINT JOB CHECK ON THE PRINTER STATUS
space. Return.
„ Type lpq and press „ Type lpc followed by a
– The status of the printer
‹ Type a job number from
Return. space.
one of the print jobs in the displays.
– The print queue displays.
list, and press Return.
– The print job is cancelled. 173
UNIX FOR MAC


INSPECT SYSTEM LOGS
up. This configuration file tells syslogd where to write each

Y
ou can learn a lot about system operations and
type of log message. By using the services of syslogd, other
problems by inspecting your system logs for error
services do not have to do their own logging. The syslog
messages and various anomalies. System logs, stored
configuration file, /etc/syslogd.conf, provides you with an
in /var/log, record the activities of many system services
opportunity to change where logs are written or to
such as e-mail and printing. You will find these files to be
deactivate certain types of logging. To modify the logging
valuable as they can be an important source of information
operations of syslogd, you can modify the configuration file
when system problems arise.
for syslogd and instruct the daemon to check the file for
changes. Do not edit the default /etc/syslogd.conf file
The most important messages about your current logon
unless you want to separate particular messages or stop
sessions appear in a log file called console.log. You can view
collecting them altogether.
these messages using the Console tool, available in
/Applications/Utilities. The scrollable window allows you to
If you keep the Console tool open while you work, you can
read the messages that accumulate after you log on. These
see these messages display as the daemon generates them.
messages include authentication failures and mounting
This is a good troubleshooting technique as it informs you
problems.
of problems immediately and reminds you to check your
log files.
A system daemon called syslog maintains most system log
files. Like numerous other daemons, the syslog daemon,
syslogd, has a configuration file that it reads when it starts



INSPECT SYSTEM LOGS




¤ Double-click your system ‹ Double-click
OPEN THE CONSOLE
APPLICATION disk. Applications.
„ On the desktop, click
Finder in the Dock.




174
11
SYSTEM ADMINISTRATION COMMANDS



The log file that gathers the most information
on most Mac OS X systems is system.log. The
system writes many routine messages to this file,
and the system.log file is routinely rotated. Older
system.log files are renamed system.log.0,
system.log.1, and so on, and are compressed
with gunzip to save space. At any point, you may
have a number of these files available to you to
help you track down a problem. Any log file may
have thousands of records ” far too many for
you to read the file from top to bottom. Using
commands like grep and awk to extract some
of this data can make the job of reviewing log
data much easier. You might consider writing
scripts that check for certain types of errors in
your log files and report the findings to you.
You can check the /etc/syslog.conf file to see
where particular types of messages are written.




– The Applications folder – The Utilities folder appears – The Console application
› Scroll down until the
appears in a Finder window. Utilities icon is visible. in a Finder window. opens.
ˇ Double-click Utilities. Á Double-click Console.




175
UNIX FOR MAC


COMPRESS LARGE FILES
The other command that you can use to compress a file is

Y
ou can greatly reduce the size of a file by
called compress. The compress command compresses a
compressing it ” down to a sixth or less of its
file using a different algorithm than gzip. It also uses a
original size when you use a good compression tool.
different file extension. Files compressed with the
Compression is a good solution for managing your disk
compress command take on the extension .Z.
space while not sacrificing files that you may need later on.
The gzip and gunzip tools are members of the GNU tools
For most files, gzip is one of the best compression tools
that many Unix systems use whether they are included in
available. It is both quick and effective, reducing files down
the distribution or added later. These commands are
to a fraction of their original size. It is also available on
included in the standard distribution of Mac OS X.
many systems, allowing you to move your compressed files
to another system, confident that you can unzip them. To
Both the gzip and the compress commands use the
compress a file, you can type gzip followed by the name of
filenames to determine whether a file is already
the file. The gzip command creates a new file with the
compressed. It is possible to compress a file again after
extension .gz appended to the end of the filename. For
renaming it, but the subsequent gain is small, and the
example, when you compress the /var/log/system.log.0 file,
likelihood of confusion high.
the resultant file is called system.log.0.gz. Unlike Windows,

<<

. 36
( 69 .)



>>