Getting Around

You can move around from directory to directory using the cd command. Give the name of the directory you want to move to, or give no name to move back to your home directory. Use the pwd command to see where you are (or rely on the prompt, if configured):

(~/docs/grad_course/i) 56% cd
(~) 57% cd /
(/) 58% ls -F
bin/	     dosc/	  gmon.out     mnt/	    sbin/
boot/	     etc/	  home@        net/	    tmp/
cdrom/	     fastboot	  lib/	       proc/	    usr/
dev/	     floppy/	  lost+found/  root/	    var/
(/) 59% cd ~/docs/
(~/docs) 60% pwd
/usr/home/lstein/docs
(~/docs) 62% cd ../projects/
(~/projects) 63% ls
Ace-browser/		   bass.patch
Ace-perl/		   cgi/
Foo/			   cgi3/
Interface/		   computertalk/
Net-Interface-0.02/	   crypt-cbc.patch
Net-Interface-0.02.tar.gz  fixer/
Pts/			   fixer.tcsh
Pts.bak/		   introspect.pl*
PubMed/			   introspection.pm
SNPdb/			   rhmap/
Tie-DBI/		   sbox/
ace/			   sbox-1.00/
atir/			   sbox-1.00.tgz
bass-1.30a/		   zhmapper.tar.gz
bass-1.30a.tar.gz
(~/projects) 64% 

Each directory contains two special hidden directories named "." and "..". "." refers always to the directory in which it is located. ".." refers always to the parent of the directory. This lets you move upward in the directory hierarchy like this:

(~/docs) 64% cd ..

and to do arbitrarily weird things like this:

(~/docs) 65% cd ../../docs

The latter command moves upward to levels, and then into a directory named "docs". The single dot directory is useful when you want to refer to an executable file unambiguously without interference from the search path (described next).

(~/bin) 65% ./arm_warheads
<< Previous
Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Thu Sep 16 16:00:46 EDT 1999