Silicon, Circuits, and the Digital Revolution

Publishing on the Web -- UNIX Crash Course

Successful management of a website requires some knowledge of the operating system of the computer from which the site is being served. In this exercise you will learn some rudimentary UNIX file handling commands.

You may find the following selections from "Using UNIX Systems" to be useful for future reference.

Today's Activities:

Run Netscape Navigator and a telnet session to your composer account simultaneously.

The UNIX prompt should appear as follows (assuming you logged onto copland):

The UNIX commands described below should be entered after this UNIX prompt, not in the pico editor or the pine e-mail program!

Listing and Removing Files:

Read through "General instructions for managing UNIX files and directories"

From the window open to UNIX, list the contents of your root directory by trying the following commands:

(change directory)
This guarantees that you are in your root directory.
Note that UNIX is a fairly terse operating system; no indication is provided that anything has happened!

(list contents of directory)
Please note: This is an "ell": l and this is a "one": 1

ls -l
(list - long)
This listing is in a longer form that shows more information, such as file permission settings and creation dates.
Note that the "space" between ls, the UNIX command, and -l, the option is essential.
"Spaces" are used to delimit the name of the UNIX command, its options, and the filename(s) on which it operates.

ls -a
(list - all)
This listing shows all files, including hidden files which have filename starting with a period.

ls -la
This combines the two special actions to ls.
You may find additional possibilities by checking the online manual for ls by entering man ls at the UNIX prompt.

ls .login
You may apply ls to list specific files.

ls core
This file, if present, is the image of core memory dumped from a previous program failure.
Sometimes difficulties with computer accounts originate with disk space problems that are exacerbated by the presence of this file; you may remove it by entering
rm core.

cd public_html
Change to the subdirectory corresponding to your personal webspace.
If you were not located in your root subdirectory, you should use cd ~/public_html

Creating Files:

Using pico, create a file with the name scitech.html, containing the words "Science and Technology":

pico scitech.html
Again, note that the "space" between pico, the UNIX command, and scitech.html, the filename to be edited, is essential. "Spaces" are used to delimit the name of the UNIX command from the filename on which it operates.
Note that pico is the same text editor used for composing e-mail messages in pine.

Enter the phrase "Science and Technology" while in pico.
Use ^O (WriteOut) to save the contents of the file.
Use ^X (Exit) to quit pico and return to the UNIX prompt.

ls scitech.html
Check that you successfully created the file by listing your root directory specifically for that file.

more scitech.html
Show the contents of the file.

Use a web browser to confirm that you have created the file in your webspace. If it does not load properly, it is likely that the file permission has not been set for reading by others. When using Netscape Composer to create webpages, this step is handled "automatically" during the ftp process...

chmod o+r scitech.html
(change the permission modes of a file)
This opens read permission to others.
Note the two spaces surrounding o+r as delimiters!

Now the web page should load properly!

(You may read through Changing Access Permissions if you would like to learn more about the chmod command.)

Copying and Renaming Files:

cp scitech.html silicon.html

ls *.html
Check that the file has been successfully copied.
* is a wildcard; all files with names ending with .tmp will be listed.

mv silicon.html circuits.html
A file is renamed in UNIX by moving it to a file with a different name.

ls *.html
Check the results.

Creating Subdirectories:

cd ~/public_html
Make sure that your are in the subdirectory that holds your webpages.

mkdir scitech
(make directory)
Make an additional subdirectory for temporary use.

ls -l sci*
Check what you've got so far.

chmod o+rx scitech
This adds read and execute permission for others seeking access to this subdirectory.
Use the web browser to confirm that this subdirectory is present and accessible.

rmdir scitech
(remove directory)
This command will remove a subdirectory if it is empty.

Creating Access-Restricted Subdirectories:

Restricting Access to Web Pages - hard
form for .htaccess file generator - easy

Make a subdirectory named SCEN103 under the subdirectory public_html by using the form above for your copland webspace.
On the online form, select individual editing and access by me and you.
We will be using this space to hold some future SCEN103 homework submissions that require access restriction.

Final Checkpoint

Create a file named text.html in the subdirectory SCEN103; the contents of the file should include your name and a friendly greeting at a minimum. Remember to execute the UNIX command
chmod o+r text.html
to set the file permissions for the new file as needed. This exercise is complete when I can view the contents of your file with my web browser...

SCEN103 Comments, suggestions, or requests to
Last updated March 15, 2000.
© George Watson, Univ. of Delaware, 2000.