Lesson 3 - File Management
Required Reading
-
Learning UNIX: Chapter 4 (File management)
- WWW: vi
editor (read the Intro and the whole Basics section)
- WWW: Symbolic
Links
Additional Notes
The vi editor can be really frustrating, but it's important
to at least know the basics. If the above article didn't do
it for you, here's another intro
to vi. I'm interested to know which was a better explanation
for you if you read both.
The section in the text on Printing Files is really only
applicable if you have an in-house server. For shared servers
such as typical ISPs, you won't be able to print files that
way.
A few more notes on the find command. The example
in the text only searches your working directory., but you
can also specify another directory for the search, such as
the root directory. That is useful if you are searching the
entire system for a particular file. Note, though, that you
may see a lot of messages about "permission denied"
for various directories on the system. That just means that
your user ID doesn't have access permissions to search that
particular directory. The find command will just skip
those directories and keep searching the rest of the system.
Just remember to scroll back through the error messages to
look for the command results.
Another useful command for locating files on your system
is which. It can be used to find executables on the
system, such as the perl interpreter. It only searches your
current PATH directories (see pg 48), though, so the find
command is more exhaustive. The syntax for the which
command is
which <commandname>
Another important concept to understand is symbolic linking.
Essentially, this is the same as making a "shortcut"
on your Windows computer or an "alias" on your Mac.
It can be very useful in a variety of situations as a webmaster.
Most notably, when you sign up for a webhosting account on
a shared-space web server, you will most likely see some symbolic
links in your home directory. How can you tell? Do a long
listing of the files (ls -l) and look for arrows in
the right most column. For example:
[ashley@server4000 ashley]$ ls -l
total 104
drwx------ 2 ashley enscript 4096 May 20 1999 Mail
drwxr-xr-x 7 ashley enscript 4096 Jul 30 00:08 enscript-anonftp
drwxr-xr-x 3 root root 4096 Nov 6 01:45 enscript-logs
drwxr-sr-x 9 ashley enscript 4096 Oct 19 18:19 enscript-mail
lrwxrwxrwx 1 root 509 12 Jul 30 00:07 enscript-secure -> enscript-www
drwxrwxrwx 46 ashley enscript 4096 Nov 6 10:43 enscript-www
lrwxrwxrwx 1 root 509 12 Jul 30 00:07 www -> enscript-www
When you use the ls -F command to list a directory, symbolic
links will have the @ symbol appended to the name of the directory
or file:
[ashley@server4000 ashley]$ ls -F
Mail/ enscript-mail/ enscript-secure@
enscript-www/ www@
enscript-anonftp/ enscript-logs/
Notice that the system administrator has setup of several
symbolic links to create aliases: enscript-secure and www
both point to the same directory (enscript-www) which is the
root HTML directory for my site.
Also, symbolic links are used to create a local alias for
a system file or to put a single file in several different
directories.
Next Step
Take the self-quiz
Complete project 2
Continue to lesson 4
|