347
Chapter 21:
Introduction to Linux Systems Administration
NOTE
Under Linux, you cannot abbreviate the rmdir command as rd as you can under DOS.
pwd: Print Working Directory
It is inevitable that eventually you will sit down in front of an already logged-in
workstation and not know where you are located in the directory tree. To get this
information, you need the pwd command. It has no parameters and its only task is to
print the current working directory. The DOS equivalent is to type cd alone; however,
under bash, typing cd simply takes you back to your home directory.
For example, to get the current working directory, enter the following command:
[root@ford src]# pwd
/usr/local/src
tar: Tape Archive
If you are familiar with the pkzip program, you are used to compression tools not
only reducing file size, but also combining multiple files into a single large file.
Linux separates this process into two tools. The compression tool is gzip, which was
discussed earlier.
The tar program combines multiple files into a single large file. The reason for
separating this program from the compression tool is that tar allows you to select
which compression tool to use or whether you even want compression. Additionally,
tar
is able to read and write to devices in much the same way that dd can, thus making
tar
a good tool for backing up tape devices.
NOTE
Although the name of the program includes the word tape, you do not need to read or
write to a tape drive when creating archives. In fact, you will rarely use tar with a tape drive in your
day-to-day work (aside from your backups).
The format of the tar command is as follows:
[root@ford /root]# tar [commands and options] filenames
Some of options available to tar are listed in Table 21-8. Refer to the man page for
the complete list.
For example, to create an archive called apache.tar containing all the files from
/usr/ src/apache, type the following:
[root@ford src]# tar -cf apache.tar /usr/src/apache
To create an archive called apache.tar containing all the files from /usr/ src/apache
and see the list of files as they are added to the archive, type the following:
[root@ford src]# tar -cvf apache.tar /usr/src/apache