This lesson discusses more file operations and introduces
some system utilities. Objectives important to this lesson:
More operating system utilities
The dd utility
Monitoring hard drives with df and du
System status commands
This chapter discusses more utility programs that are included
in UNIX/Linux. The first several pages list utilities according
to eight types. The organization of eight tables by these types
is meant to help you find the right tool for a task that
alter the status of files, directories, and system objects
status and configure network objects, as well as make and
diagnose network connections
rights on the network and manage network devices
Allow users to
create programs in C and related languages
program development environment on the network
don't fit the seven categories above: we will discuss a
The text lists and briefly describes many utilities in several
tables. Mercifully, it only spends the next 25 pages discussing
them. We will concentrate on a few.
File processing utilities
The dd utility is used to copy files when you need to
specify parameters for the destination file that are
different from the source file. The text gives us examples of
converting from one character code to another (like
ASCII to EBCDIC), one block size to another, one case
to another, and from variable length records to fixed
The df and du commands are related.
The df command stands for disk free. Its
purpose is to tell us how much space is used and how
much space is available on a file storage device.
Think of df as a high level view of storage compared to du,
which stands for disk usage.
You might think that the two commands supply the same
information, but the du command can give us data not
just for the disk drives, but for every folder
on those drives. Use it for more detailed analysis of how a
server's hard drives are being used.
Garbage files are files on a system that have no
further purpose for the user or process that created them. In
order to find them, however, users should be taught to name
their files in reasonable ways, such as appending .test or .tmp
to files that are only to be used in a test or a day's events.
With names that we can trust, we can run searches for files of
that we are sure should be removed from a system. Note the
syntax of the command on page 410 that uses find to
locate files named either a.out or core, then
uses the -exec option of find to run the rm
command on each filename that is found. This kind of script
should be checked for errors very well before it is trusted to
System status utilities
On page 411, the text discusses the top command, which
runs a check on the system's CPU, and returns a list of the processes
that are causing the heaviest load on it, updating the
list every five seconds while top is being run. top runs until
you stop it by pressing q, for quit. While it is
running, you can press k (for kill) to bring up
an interface to kill (end) a process that should not be allowed
On page 412, the text describes the free command, which
reports information about system RAM. It can be set to run
continuously with the -s option. If running continuously,
quitting is done by typing ctrl-c.
The text reminds us (if we already know) that processes running
in memory are assigned process ID numbers, also called PIDs.
You can see four of them in the image above for the top command.
The text tells us on page 414 that we might want to run top in
the background instead of running it in its normal mode,
which takes over the terminal console. The command to run any
process in the background is just to add an ampersand
(&) to the command that starts the process.
Any program that is running may start several processes, which
makes it hard to keep track of them. The text explains that we
can use the ps command to list all or some
of the processes that are currently running.
You already know that you can run the top command and
kill a process from it. But that only gives you access to the
most processor intensive processes. To kill any process,
you can use the kill command (assuming you have rights
to do so). To kill a process the syntax is kill PID,
or kill processname. You can also use the pkill
command with the name of a user to kill all processes that
belong to that user.
On page 435, the text begins a discussion of several utilities
that relate to network setting and use.
ifconfig - This is a lot like the ipconfig utility
you may have used in Windows environments. The text gives you
some background in IP addressing, and spends too little space
on doing it for anyone not aware of how IP addresses work. If
you are not comfortable with IP addresses, spend a few minutes
set of notes from NET 102. You should have the
ideas down in a few minutes. Once you know what to expect from
the IP settings on your computer, you can use the
ifconfig command to see what they are, and make repairs if
ping - The ping command actually sends a signal
to an IP address, typically that of a computer on your
own or another network, to prove that a connection to that
device can be made. If the ping fails, something is wrong with
your computer, the other computer, or any part of the links
that would connect the two computers.
traceroute - The traceroute command sends a series
of signals to another device, and reports information
about the variouslinks that the signals pass
through on their way to the other device.
netstat - The netstat command, issued by itself, will
report all IP address/port assignments that this computer
knows about. It effectively reports the routing table that has
been collected by this computer, which means a table
of connections this computer has or knows about on its
network. This is not static information. It is assembled by
netstat by querying the computer, which means it could change
at any moment, as new connections are opened and old ones are
closed. Note the -p switch that shows programs
actively using connections.
Assignment: Try out a few of the command from this
lesson, and report on them in the group discussion.