<HTML
><HEAD
><TITLE
>Directories and paths</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
REL="HOME"
TITLE="GNOME User's Guide"
HREF="index.html"><LINK
REL="UP"
TITLE=" If you are new to Linux/UNIX"
HREF="newbies.html"><LINK
REL="PREVIOUS"
TITLE="Files and filenames"
HREF="new-file.html"><LINK
REL="NEXT"
TITLE="Permissions"
HREF="permissions.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>GNOME User's Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="new-file.html"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Appendix A. If you are new to Linux/UNIX</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="permissions.html"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="NEW-DIRS"
>Directories and paths</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="NEW-DIRSTRUCT"
>Directory structure</A
></H2
><P
>	Now, let's discuss the concept of directories. A <I
CLASS="EMPHASIS"
>directory</I
>
	is a collection of files. It can be thought of as a ``folder'' that
	contains many different files. Directories are given names, with which
	they can be identified. Furthermore, directories are maintained in a
	tree-like structure; that is, directories may contain other
	directories. The top level directory is called the "root directory" and
	denoted by <TT
CLASS="FILENAME"
>/</TT
>; it contains all the files in your system.
      </P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="NEW-PATH"
>Pathnames</A
></H3
><P
>	  A <I
CLASS="EMPHASIS"
>pathname</I
> is really like a path to a file.  You
	  can refer to a file by its pathname, which is made up of the filename,
	  preceded by the name of the directory containing that file. This, in
	  turn, is preceded by the name of directory containing <I
CLASS="EMPHASIS"
>that
	  directory</I
>, and so on. A typical pathname make look like
	  <TT
CLASS="FILENAME"
>/home/sasha/talk.txt</TT
> which refers to the file
	  <TT
CLASS="FILENAME"
>talk.txt</TT
> in the directory
	  <TT
CLASS="FILENAME"
>sasha</TT
> which in turn is a subdirectory in
	  <TT
CLASS="FILENAME"
>/home</TT
>.
	</P
><P
>	  As you can see, the directory and filename are separated by a
	  single slash (/). For this reason, filenames themselves cannot
	  contain the / character.  MS-DOS users will find this
	  convention familiar, although in the MS-DOS world the
	  backslash (\) is used instead. The directory that contains a
	  given subdirectory is known as the <I
CLASS="EMPHASIS"
>parent
	    directory</I
>. Here, the directory <TT
CLASS="FILENAME"
>home</TT
> is
	  the parent of the directory <TT
CLASS="FILENAME"
>sasha</TT
>.
	</P
><P
>	  Each user has a home directory, which is the directory set aside for
	  that user to store his or her files.  Usually, user home directories
	  are contained under <TT
CLASS="FILENAME"
>/home</TT
>, and are named for the
	  user owning that directory, so that the home directory of user
	  <SPAN
CLASS="SYSTEMITEM"
>sasha</SPAN
> would be 
	  <TT
CLASS="FILENAME"
>/home/sasha</TT
>.
	</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="NEW-RELATIVE"
>Relative directory names</A
></H2
><P
>	At any moment, commands that you enter are assumed to be
	<I
CLASS="EMPHASIS"
>relative</I
> to your current working
	directory. You can think of your working directory as the
	directory in which you are currently ``located''. When you
	first log in, your working directory is set to your home
	directory &#8212; for user sasha, it would be
	<TT
CLASS="FILENAME"
>/home/sasha</TT
>. Whenever you refer to a
	file, you may refer to it in relationship to your current
	working directory, rather than specifying the full pathname of
	the file.
      </P
><P
>	For example, if your current directory is
	<TT
CLASS="FILENAME"
>/home/sasha</TT
>, and you have a file there called
	<TT
CLASS="FILENAME"
>talk.txt</TT
>, you can refer to it just by its file
	name: a command like <B
CLASS="COMMAND"
>emacs talk.txt</B
> issued from the
	directory <TT
CLASS="FILENAME"
>/home/sasha</TT
> is equivalent to
	<B
CLASS="COMMAND"
>emacs /home/sasha/talk.txt</B
>
	(<TT
CLASS="APPLICATION"
>emacs</TT
> is an extremely powerful editor for
	text files; new users may prefer something simpler, such as
	<TT
CLASS="APPLICATION"
>gnotepad</TT
>, but for power user,
	<TT
CLASS="APPLICATION"
>emacs</TT
> is indispensable).
      </P
><P
>	Similarly, if, in <TT
CLASS="FILENAME"
>/home/sasha</TT
> you have a
	subdirectory called <TT
CLASS="FILENAME"
>papers</TT
> and, in that
	subdirectory, a file called <TT
CLASS="FILENAME"
>fieldtheory.txt</TT
>, you
	can refer to it as <TT
CLASS="FILENAME"
>papers/fieldtheory.txt</TT
>.
      </P
><P
> If you begin a filename (like
	<TT
CLASS="FILENAME"
>papers/fieldtheory.txt</TT
>) with a character
	other than /, you're referring to the file in terms relative
	to your current working directory. This is known as a relative
	pathname.  On the other hand, if you begin a filename with a
	/, the system interprets this as a full pathname &#8212; that
	is, a pathname that includes the entire path to the file,
	starting from the root directory, /. Use of the full pathname
	is known as an <I
CLASS="EMPHASIS"
>absolute pathname</I
>.
      </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="NEW-PATH-CONV"
>Pathname conventions</A
></H2
><P
>	Here are some standard conventions you can use in paths: 
      </P
><P
>	<TT
CLASS="FILENAME"
>~/</TT
> &#8212; user's home directory
      </P
><P
>	<TT
CLASS="FILENAME"
>./</TT
>  &#8212; current working directory
      </P
><P
>	<TT
CLASS="FILENAME"
>../</TT
>  &#8212; parent of the current directory
      </P
><P
>	For example, if sasha's current directory is
	<TT
CLASS="FILENAME"
>/home/sasha/papers</TT
>, he can refer to the file
	<TT
CLASS="FILENAME"
>/home/sasha/talk.txt</TT
> as
	<TT
CLASS="FILENAME"
>~/talk.txt</TT
> or as <TT
CLASS="FILENAME"
>../talk.txt</TT
>.
      </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="new-file.html"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="permissions.html"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Files and filenames</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="newbies.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Permissions</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>