349
Chapter 21:
Introduction to Linux Systems Administration
more: Display a File One Screen at a Time
The more command works in much the same way as the DOS version of the program.
It displays an input file one screen at a time. The input file can come from either more's
standard input or a command-line parameter. Additional command-line parameters
exist for this command; however, they are rarely used. See the man page for additional
information.
For example, to view the /etc/passwd file one screenful at a time, type the following:
[root@ford /root]# more /etc/passwd
To view the directory listing generated by the ls command one screenful at a time,
type the following:
[root@ford /root]# ls | more
du: Disk Utilization
You will often need to determine where and by whom disk space is being consumed,
especially when you're running low on it! The du command allows you to determine
the disk utilization on a directory-by-directory basis. Table 21-9 lists some of the
options for du.
For example, to display in a human-readable format the amount of space each
directory in the /home directory is taking up, type the following:
[root@ford /root]# du -sh /home/*
which: Show the Directory in Which a File Is Located
The which command searches your entire path to find the name of the file specified
on the command line. If it finds the filename, the tool displays the actual path of the
requested file. The purpose of this command is to help you find fully qualified paths.
Options
Description
-c
Produce a grand total at the end of the run.
-h
Print sizes in human-readable format.
-k
Print sizes in kilobytes rather than block sizes. (Note that under
Linux, one block is equal to 1KB. However, this is not true for all
flavors of UNIX.)
-s
Summarize; print only one output for each argument.
Table 21-9.
Common du Command Options