Datasheet

20
Phase 1
Working on the Command Line
want the copied fstab file to be accessible under two names; you can delete either of the two
hard links with rm:
$ rm fstab
This example deletes the second link; if sample-file had been deleted instead, you’d
break the symbolic link (another-link).
You should be aware that some file operations will do odd things with links, and particu-
larly with symbolic links. For instance, if you create a CD-R from files on your hard disk, you
might find that it contains duplicates of files that are links in the original directory tree. This
behavior can result in an unexpected increase in the space required on your CD-R media. Some
tools provide options that influence how they treat links, so consult your tool’s man page or
other documentation if you run into link-handling problems.
Criteria for Completion
To complete this task, you should create and delete links in the test directory you created in
Task 1.2. You should create both hard links, which are duplicate directory entries, and soft
links, which are special files that point to other files by name.
Task 1.4: Find Files
A complete Linux system is likely to contain thousands of files. Although Linux uses a hier-
archical directory structure designed to place files in particular locations depending upon their
types, sometimes files get lost. You might know that a file is present but be unable to locate
it because you’ve forgotten its location or because it’s been accidentally moved. In such cases,
knowledge of Linux’s file-location commands can be invaluable.
Scenario
Returning to the scenario from Task 1.1, suppose you didn’t find the whatis executable where
you expected it, in /usr/bin. Your task now is to see if the file might be located somewhere
else on the computer. To do this, you’ll use several Linux commands that are designed to help
you find files.
Scope of Task
This task covers three Linux commands for locating files: find, locate, and whereis. Each
of these three commands has its own unique strengths and weaknesses, and you should learn
the basics of all three of them.
83484.book Page 20 Monday, September 18, 2006 8:58 AM