67 lines
3.8 KiB
HTML
67 lines
3.8 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.9 The current working directory</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="3.2.9 The current working directory">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3078 HREF="node105.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3076 HREF="node95.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3070 HREF="node103.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3080 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3081 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3079 HREF="node105.html">3.2.10 Referring to home </A>
|
|
<B>Up:</B> <A NAME=tex2html3077 HREF="node95.html">3.2 Basic UNIX Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html3071 HREF="node103.html">3.2.8 The directory tree</A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION00529000000000000000>3.2.9 The current working directory</A></H2>
|
|
<P>
|
|
<A NAME=2018> </A>
|
|
<A NAME=2019> </A>
|
|
<A NAME=2020> </A>
|
|
<A NAME=2021> </A>
|
|
At any given time, commands that you type to the shell are given in
|
|
terms of your <b>current working directory</b>. You can think of your
|
|
working directory as the directory in which you are currently ``located''.
|
|
When you first login, your working directory is set to your home
|
|
directory---<tt>/home/larry</tt> in our case. Whenever you reference a file,
|
|
you may refer to it in relationship to your current working directory,
|
|
instead of specifying the full pathname of the file.
|
|
<P>
|
|
Here's an example. Larry has the directory <tt>papers</tt>, and
|
|
<tt>papers</tt> contains the file
|
|
<tt>history-final</tt>. If Larry wants to look at this file, he can use
|
|
the command
|
|
<P><TT> /home/larry# <em>more /home/larry/papers/history-final</em>
|
|
<P></TT>
|
|
The <tt>more</tt> command simply displays a file, one screen at a time.
|
|
However, because Larry's current working directory is <tt>/home/larry</tt>,
|
|
he can instead refer to the file <em>relative</em> to his current
|
|
location. The command would be
|
|
<P><TT> /home/larry# <em>more papers/history-final</em>
|
|
<P></TT>
|
|
<A NAME=2036> </A>
|
|
Therefore, if you begin a filename (such as <tt>papers/final</tt>) with a
|
|
character other than ``<tt>/</tt>'', the system assumes that you're
|
|
referring to the file in terms relative to your current working directory.
|
|
This is known as a <b>relative pathname</b>.
|
|
<P>
|
|
<A NAME=2040> </A>
|
|
<A NAME=2041> </A>
|
|
On the other hand, if you begin a filename with a ``<tt>/</tt>'', the system
|
|
interprets this as a full pathname---that is, a pathname including
|
|
the entire path to the file, starting from the root directory, <tt>/</tt>.
|
|
This is known as an <b>absolute pathname</b>.
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3078 HREF="node105.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3076 HREF="node95.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3070 HREF="node103.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3080 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3081 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3079 HREF="node105.html">3.2.10 Referring to home </A>
|
|
<B>Up:</B> <A NAME=tex2html3077 HREF="node95.html">3.2 Basic UNIX Concepts</A>
|
|
<B> Previous:</B> <A NAME=tex2html3071 HREF="node103.html">3.2.8 The directory tree</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|