87 lines
4.9 KiB
HTML
87 lines
4.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>3.2.7 Files and directories</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="3.2.7 Files and directories">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3054 HREF="node103.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3052 HREF="node95.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3046 HREF="node101.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3056 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3057 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3055 HREF="node103.html">3.2.8 The directory tree</A>
|
|
<B>Up:</B> <A NAME=tex2html3053 HREF="node95.html">3.2 Basic UNIX Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html3047 HREF="node101.html">3.2.6 Changing your password</A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION00527000000000000000>3.2.7 Files and directories</A></H2>
|
|
<P>
|
|
<A NAME=1898> </A>
|
|
Under most operating systems (UNIX included), there is the concept of a
|
|
<b>file</b>, which is just a bundle of information which is given a
|
|
name (called a <b>filename</b>). Examples of files would be your
|
|
history term paper, an e-mail message, or an actual program which can be
|
|
executed. Essentially, anything which is saved on disk is saved in
|
|
an individual file.
|
|
<P>
|
|
<A NAME=1901> </A>
|
|
Files are identified by their filenames. For example, the file containing
|
|
your history paper might be saved with the filename <tt>history-paper</tt>.
|
|
These names usually identify the file and its contents in some form
|
|
which is meaningful to you. There is no standard format for filenames
|
|
as there is under MS-DOS and other operating systems; in general, filenames
|
|
may contain any character (except <tt>/</tt>---see the discussion of
|
|
pathnames, below), and are limited to 256 characters in length.
|
|
<P>
|
|
<A NAME=1904> </A>
|
|
With the concept of files comes the concept of directories. A
|
|
<b>directory</b> is just a collection of files. It can be thought of
|
|
as a ``folder'' which contains many different files. Directories
|
|
themselves are given names, with which you can identify them.
|
|
Furthermore, directories are maintained in a tree-like structure;
|
|
that is, directories may contain other directories.
|
|
<P>
|
|
<A NAME=1906> </A>
|
|
A file may be referred to by its <b>pathname</b>, which is made up of
|
|
the filename, preceded by the name of the directory which contains the file.
|
|
For example, let's say that Larry has a directory called <tt>papers</tt>,
|
|
which contains three files: <tt>history-final</tt>, <tt>english-lit</tt>,
|
|
and <tt>masters-thesis</tt>. (Each of these three files contains information
|
|
for three of Larry's ongoing projects.) To refer to the file
|
|
<tt>english-lit</tt>, Larry can specify the file's pathname:
|
|
<P><TT> papers/english-lit
|
|
<P></TT>
|
|
<P>
|
|
<A NAME=2075> </A>
|
|
As you can see, the directory and file names are separated by a single
|
|
slash (<tt>/</tt>). For this reason, filenames themselves cannot contain the
|
|
<tt>/</tt> character. MS-DOS users will find this convention familiar,
|
|
although in the MS-DOS world, the backslash (<code>\</code>) is used instead.
|
|
<P>
|
|
<A NAME=1918> </A>
|
|
As mentioned, directories can be nested within each other as well. For
|
|
example, let's say that Larry has another directory, within <tt>papers</tt>,
|
|
called <tt>notes</tt>. This directory contains the files <tt>math-notes</tt>
|
|
and <tt>cheat-sheet</tt>. The pathname of the file <tt>cheat-sheet</tt> would be
|
|
<P><TT> papers/notes/cheat-sheet
|
|
<P></TT>
|
|
<P>
|
|
<A NAME=1926> </A>
|
|
<A NAME=1927> </A>
|
|
Therefore, the pathname really is a ``path'' which you take to
|
|
locate a certain file. The directory above a given subdirectory is
|
|
known as the <b>parent directory</b>. Here, the directory <tt>papers</tt>
|
|
is the parent of the <tt>notes</tt> directory.
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3054 HREF="node103.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3052 HREF="node95.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3046 HREF="node101.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3056 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3057 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3055 HREF="node103.html">3.2.8 The directory tree</A>
|
|
<B>Up:</B> <A NAME=tex2html3053 HREF="node95.html">3.2 Basic UNIX Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html3047 HREF="node101.html">3.2.6 Changing your password</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|