A Complete Guide to Web Design

(やまだぃちぅ) #1
54 Chapter 4 – A Beginner’s Guide to the Server

Introduction to Unix


Web Design in a Nutshell, eMatter Edition

Basic Unix Commands


The general format for Unix commands is:
commandoption(s) filename(s)
The command in bold must be typed in exactly as shown and the values in italics
stand for variables that you supply. Some general guidelines for Unix syntax are:


  • Commands are entered in lowercase.

  • Optionsmodify the way in which a command works. They are often single
    letters prefixed with a minus (-) sign and set off by any number of spaces or
    tabs. The options listed in this chapter typically can be indicated in one com-
    mand line by setting them off individually or combining them after a single
    minus sign. Note: This rule may vary depending on the type of Unix system
    you are using. Ask your server administrator for help if you run into prob-
    lems.

  • The argumentfilenameis the name of a file you want to manipulate in
    some way.

  • Spaces between commands, options, and filenames are important; e.g., “ls -al”
    works, “ls-al” doesn’t.

  • The asterisk symbol () is a wildcard character that can be used to substitute
    for any string of characters in a file or directory name. For instance, a search
    for
    .html will retrieve all documents ending in .html.
    The following is a brief list of Unix commands that are useful for navigating
    through directories and managing files.


cd
cd [pathname]

This changes your working directory to the specified directory.cdalone (without
arguments) will take you to your home directory.

cp
cp [old] [new]

This makes a copy of a file whereoldis a pathname to the original file andnewis
the name you want to give the copy of the file. (This is similar to the “save as”
function in an application.) The following sample code makes a copy of the file
art.html and names the copyart2.html.
% cp art.html art2.html
cp [file] [directory]

This puts a copy of the original file into an existing directory. The following
sample code makes a copy ofart.html and puts it in Richard’s work directory:
% cp art.html /user/richard/work
Free download pdf