blank.gif (43 bytes)

Church Of The
Swimming Elephant


Unix File Management Quick Reference
Unix files are stored in a directory tree, and each user has a home 
directory. The upper-most level of the file system is called root and is 
referenced by the character "/". Under root are any number of 
subdirectores, with user's home directory typically under /home or 
/users; for example, /home/auser is the pathname of a user's home 
directory. Files or other directories may be stored under the user's home 
Changing your working directory
Type "pwd" to display your working directory, and type "cd" to change the 
working directory:
	$ pwd
	$ cd play
	$ pwd
To return to your home directory from any location, type "cd" with no 
pathname following it.
Listing files
To see the files in a directory, use the ls command:
	$ ls
	play   prog1   work
If you have a new account and are logged in for the first time, ls will 
display nothing and you'll see a new shell prompt. Some files are 
normally hidden from view to ls -- to see these use the -a option:
	$ ls -a
	.   ..   .kshrc   .exrc   .profile   play   prog1
Filenames starting with "." are not displayed by ls unless the -a option 
is used: ".." refers to the parent directory (the one above the current 
working directory); "." is the relative name for the current working 
directory; .profile and .kshrc contain commands automatically executed 
when you login; and .exrc contains commands automatically executed when 
you run the ex or vi editors. Note that other Unix shells may use 
different system files.
To see the types of files displayed by ls, use ls -F as shown below:
	$ ls -F
	play/   prog1*   work
Directories are listed with a "/" at the end of their names, and 
executable programs are listed with a "*" at the end.
Seeing inside files
 Use the command more to view a fileÕs contents:
	$ more work
	This file is a very short one to show how
	more does it's work.
At the --More-- prompt, press the space bar to see the next screen's worth 
of the file. If more is not on your system, try pg.
Creating files
Files are usually created with an editing program; see the Quick 
Reference handouts on vi and Emacs for information about these.
Copying and moving files
Use cp to copy a file to a new one, and use mv to change a file's name
	$ cp work morework
	$ mv morework lesswork
Removing files
Use rm to remove a file from your directory:
	$ rm lesswork
Caution: be very careful using rm -- there is usually no easy way to 
recover files removed with it.
Creating and removing directories
Use mkdir to make directories in your home directory, and use rmdir to 
remove those directories:
	$ mkdir newstuff
	$ ls -F
	newstuff/   play/   prog1*   work
	$ rmdir newstuff
Note that rmdir will remove directories only when they are empty!
Help facilities
See the man pages for the commands discussed above.
Related topics
See the Quick Reference handouts for the vi and ex editors and the Emacs 


Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

Have you gone to church today?
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609