129 lines
4.4 KiB
HTML
129 lines
4.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE> From DOS/Windows to Linux HOWTO : Using Directories </TITLE>
|
|
<LINK HREF="DOS-Win-to-Linux-HOWTO-6.html" REL=next>
|
|
<LINK HREF="DOS-Win-to-Linux-HOWTO-4.html" REL=previous>
|
|
<LINK HREF="DOS-Win-to-Linux-HOWTO.html#toc5" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-6.html">Next</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-4.html">Previous</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO.html#toc5">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="Directories"></A> <A NAME="s5">5. Using Directories </A></H2>
|
|
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss5.1">5.1 Directories: Preliminary Notions</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>We have seen the differences between files under DOS/Win and Linux. As for
|
|
directories, under DOS/Win the root directory is <CODE>\</CODE>, under Linux
|
|
it is <CODE>/</CODE>. Similarly, nested directories are separated by <CODE>\</CODE>
|
|
under DOS/Win, by <CODE>/</CODE> under Linux. Example of file paths:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
DOS: C:\PAPERS\GEOLOGY\MID_EOC.TEX
|
|
Linux: /home/guido/papers/geology/middle_eocene.tex
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>As usual, <CODE>..</CODE> is the parent directory and <CODE>.</CODE> is the current
|
|
directory. Remember that the system won't let you <CODE>cd</CODE>, <CODE>rd</CODE>,
|
|
or <CODE>md</CODE> everywhere you want. Each user has his or her stuff in a
|
|
directory called `home', given by the system administrator; for instance, on
|
|
my PC my home dir is <CODE>/home/guido</CODE>.
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="Directories Permissions"></A> <A NAME="ss5.2">5.2 Directories Permissions </A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Directories, too, have permissions. What we have seen in Section
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-4.html#Permissions">Permissions and Ownership</A> applies to directories as
|
|
well (user, group, and other). For a directory, <CODE>rx</CODE> means you can
|
|
<CODE>cd</CODE> to that directory, and <CODE>w</CODE> means that you can delete a
|
|
file in the directory (according to the file's permissions, of course), or
|
|
the directory itself.
|
|
<P>For example, to prevent other users from snooping in
|
|
<CODE>/home/guido/text</CODE>:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ chmod o-rwx /home/guido/text
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="Directories: Trans"></A> <A NAME="ss5.3">5.3 Directories: Translating Commands </A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
DIR: ls, find, du
|
|
CD: cd, pwd
|
|
MD: mkdir
|
|
RD: rmdir
|
|
DELTREE: rm -rf
|
|
MOVE: mv
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>
|
|
<H3>Examples</H3>
|
|
|
|
<P>
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
DOS Linux
|
|
---------------------------------------------------------------------
|
|
|
|
C:\GUIDO>DIR $ ls
|
|
C:\GUIDO>DIR FILE.TXT $ ls file.txt
|
|
C:\GUIDO>DIR *.H *.C $ ls *.h *.c
|
|
C:\GUIDO>DIR/P $ ls | more
|
|
C:\GUIDO>DIR/A $ ls -l
|
|
C:\GUIDO>DIR *.TMP /S $ find / -name "*.tmp"
|
|
C:\GUIDO>CD $ pwd
|
|
n/a - see note $ cd
|
|
ditto $ cd ~
|
|
ditto $ cd ~/temp
|
|
C:\GUIDO>CD \OTHER $ cd /other
|
|
C:\GUIDO>CD ..\TEMP\TRASH $ cd ../temp/trash
|
|
C:\GUIDO>MD NEWPROGS $ mkdir newprogs
|
|
C:\GUIDO>MOVE PROG .. $ mv prog ..
|
|
C:\GUIDO>MD \PROGS\TURBO $ mkdir /progs/turbo
|
|
C:\GUIDO>DELTREE TEMP\TRASH $ rm -rf temp/trash
|
|
C:\GUIDO>RD NEWPROGS $ rmdir newprogs
|
|
C:\GUIDO>RD \PROGS\TURBO $ rmdir /progs/turbo
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>Notes:
|
|
<P>
|
|
<UL>
|
|
<LI> when using <CODE>rmdir</CODE>, the directory to remove must be empty. To
|
|
delete a directory and all of its contents, use <CODE>rm -rf</CODE> (at your own
|
|
risk).
|
|
</LI>
|
|
<LI> the character `<CODE>~</CODE>' is a shortcut for the name of your
|
|
home directory. The commands <CODE>cd</CODE> or <CODE>cd ~</CODE> will take you to
|
|
your home directory from wherever you are; the command <CODE>cd ~/tmp</CODE>
|
|
will take you to <CODE>/home/your_home/tmp</CODE>.
|
|
</LI>
|
|
<LI> <CODE>cd -</CODE> ``undoes'' the last <CODE>cd</CODE>.
|
|
</LI>
|
|
</UL>
|
|
<P>
|
|
<P>
|
|
<HR>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-6.html">Next</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-4.html">Previous</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO.html#toc5">Contents</A>
|
|
</BODY>
|
|
</HTML>
|