Unix File System and Editor

Unix is an operating system, like MS/DOS or Windows. Most of the internet software was originally designed for Unix machines, and therefore many tools accept Unix commands. Even if you don't plan to use a Unix machine to surf the internet, it helps to understand some basic commands.

The Unix File System

Unix organizes files into a hierarchy. Each entry in the hierarchy is either a file or another directory. To get a listing of all the files and sub-directories in a directory, use the ls (list) command:

      % ls 
When I type this command in the directory containing these class notes, I get the following response:
      % ls
      NEEDS           exam.html       home.html       references.html www.html
      arch.html       ftp.html        hw.html         telnet.html
      bios.html       ftp.txt         intro.html      unix.html
      email.html      gopher.html     mbone.html      usenet/
      ethics.html     history.html    newsgroups.html wais.html
This tells me that there are many files containing Mosaic text (each ending in .html), and a subdirectory named usenet. (The ls commend on my machines appends a slash to a name to indicate a subdirectory. Not all versions of the ls command do this for you. Try ls -F if you want this feature.)

Note: the ls command doesn't actually list all the files in a directory. Unix has a number of special system files whose name begins with a period; these files are not listed unless you explicitly ask for all files using ls -a.

To move to a subdirectory, use the cd (change directory) command:

      % cd usenet 

To back up to a parent directory, use the following command:

      % cd ..

To get back to the top-level directory, use cd without any arguments as follows:

      % cd

To see the contents of a file, use the more command.

      % more bios.html
The more command will print a screen's worth of the contents of the file, notify you of the percentage of the file that has been displayed, and page through the contents of the file (if you hit the <SPACE> key), or move through the file a line at a time (if you hit the <RETURN> key). At any point you can quit the more program by entering "q" or "Q".

There are many situations where you will find yourself on some distant Unix machine and these few commands (ls, cd, and more) are all you need to navigate your way around the system.

A Unix Text Editor

Since we will be using a Unix machine to send mail messages, we need to use a Unix text editor to compose messages. Here are a few simple commands that will allow you to compose a message using the vi text editor.

To enter the editor, type vi followed by the name of the file you wish to create (if you're editing this file for the first time) or edit (if it already exists).

      % vi message1

You will be presented with an empty screen, with the cursor in the upper left corner. You are now ready to give vi a command to enter text.

Most vi commands require one or two key strokes. Here are the most useful commands:

Return to course introduction.