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.
As a context for learning a few of the commands,
a .plan file will be created, your .signature file will be checked,
and a subdirectory for SCEN103 will be created in your webspace.
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):
copland.udel.edu%
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
"Managing UNIX Files and Directories"
From the window open to UNIX, list the contents of your root directory by
trying the following commands:
- cd
- (change directory)
- This guarantees that you are in your root directory.
- Note that UNIX is a fairly terse operatiny system;
no indication is provided that anything has happened!
- ls
- (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.
Creating Files:
Using pico, create a file with the name scen103.tmp,
containing the words "Science and Technology":
- pico scen103.tmp
- Again, note that the "space" between pico, the UNIX command,
and scen103.tmp, 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 scen103.tmp
- Check that you successfully created the file
by listing your root directory specifically for that file.
- more scen103.tmp
- Show the contents of the file.
Copying and Renaming Files:
- cp scen103.tmp silicon.tmp
- (copy)
-
- ls *.tmp
- Check that the file has been successfully copied.
- * is a wildcard; all files with names ending with .tmp will be listed.
- mv silicon.tmp circuits.tmp
- (move)
- A file is renamed in UNIX by moving it to a file with a different name.
- ls *.tmp
- Check the results.
- rm *.tmp
- Remove the temporary files.
- ls *.tmp
- Check that the files have been successfully removed.
Creating a .plan File:
Do you have a .plan file already?
.plan is the hidden file that will be associated
with the display of your account information
accessed via the finger command.
- finger -m ghw
- Notice that you can see when I have last logged in, which computer I used,
and when I have last read my mail. Also my .plan is listed!
- finger ghw@udel.edu
- This finger command gives different kind of information.
- ls .plan
- Do you have a .plan file?
- pico .plan
- If not, create one using pico.
- Don't forget the leading period in the filename.
- Be creative, but not too long-winded!
- Exit pico and
and make your .plan file accessible to the finger command issued by others
by using the chmod command twice as follows:
- chmod go+x .
- (change the permission modes of a file)
- This opens execute permission to others from your root directory (represented by .)
needed by the finger command.
- Note the two spaces surrounding go+x as delimiters!
-
(You may read through
Changing Access Permissions
if you would like to learn more about the chmod command.)
- chmod go+r .plan
- This adds read premission to your .plan file.
- finger your_username
- Confirm that your .plan appears as you wish by fingering your account.
- When you are satisfied, let me know and I will confirm that it is readable by the world.
- finger your_username@udel.edu
- Also check the difference between this and the finger command above.
Check Point: Your .signature File:
Do you have a .signature file already?
Use the ls command to check.
If there is a file by that name, use more to display its contents.
If you have not yet created .signature,
create a .signature file using pine; [S]etup, [S]ignature.
Include information about yourself, or a closing comment, that you would
like attached to all of your outgoing mail.
Confirm that your .signature is working by e-mailing me a brief message.
Creating Subdirectories:
- cd public_html
- Change to the subdirectory which holds your webpages.
- mkdir scen103
- (make dirirectory)
- Make a subdirectory named scen103 under the subdirectory public_html.
- We will be using this space to hold some future SCEN103 homework submissions.
- mkdir scentemp
- Make an additional subdirectory for temporary use.
- ls -l scen*
- Check what you've got so far.
- rmdir scentemp
- (remove dirirectory)
- This command will remove a subdirectory if it is empty.
Final Checkpoint
Create a file named text.html in the subdirectory scen103;
the contents of the file should include your name.
Remember to execute the UNIX command webpublish
to set the file permissions for the new subdirectory and file.
This exercise is complete when I can view the contents of your file
with my web browser...
Top of page;
Back to SCEN103 Assignments.
Comments, suggestions, or requests to ghw@udel.edu.
"http://www.physics.udel.edu/~watson/scen103/99s/unix.html"
Last updated March 5, 1999.
Copyright George Watson, Univ. of Delaware, 1999.