|
"Pluralitas non ponenda est sine necessitate"
- Multiplicity is not to be asserted when it is unnecessary
I realize that many of you have never had the experience with the
Unix system. I repeat, the best way for you to learn about the
Unix is to experiment, and "Read The Fine Manuals" (RTFM) that
are available to you. Of course, introductory books and references
from the library (you know, the place where they keep all the
sci-fi stories) and other sources are always useful additions
for accelerating your learning curve.
For example, the system administrators (a.k.a. Unix gurus) are
the people responsible for maintaining the system in CEE UCL.
Reading the instructions and experiment is how they learned what
they know, and how you can learn what you need to know to
maximize your experience with Unix.
Before proceeding to "Unix Crash Course 101," there're several
important idiosyncrasies of Unix you should know in beforehand;
- Unix is case sensitive. This
means that Unix distinguishes between uppercase and lowercase
letters, i.e., Bill and bill don't mean the same thing to Unix.
Most command names and files are entirely in lower-case.
Therefore, you should generally plan to type in lower-case
for most commands, file and directory names.
- There are a number of different "flavors" of Unix shells
(called command interpreters) available in CEE UCL network.
By different "flavors" I mean different shells that handle
your input in their own unique way. Depends on the type of
your account, your default login shell could be the
Bash
(Bourne Again shell) shell or tcsh (T-shell) shell.
Majority of the Unix topics in this exercise will be
identical with other shells, but there'll be some
shell-specific differences.
It is possible to determine which shell is in use by
typing "echo $SHELL" at the command prompt. The response
for the Bash shell would be "/usr/local/bin/bash*" that "*"
stands for its version number. Another popular shell
is the Tc shell (=tcsh) which would respond with "/usr/local/bin/tcsh."
- Unix commands can only be entered at the
shell prompt. Unix commands begin with a command name,
often followed by flags and arguments (options, filenames
and/or other expressions) and ends with a key.
In a sense, Unix commands are similar to verbs in English.
The option flags act like adverbs by modifying the
action of the command, and filenames and expressions
act like objects of the verb. The general syntax for
a Unix command is:
-
command
[flags]
argument1
argument2
·
·
·
The brackets around the flags is a shorthand way to indicate
that they are often optional, and only need to be invoked
when you want to use that flag. Also, flags need not always
be specified separately, each with their own proceeding
hyphen (or frequently referred as "minus sign"). Many times,
the flags can be listed one after the other after a single
hyphen. You'll find some examples later on (such as "
ls"
and "ps" commands).
For the time being, following example would illustrate
typical command syntax:
-
chmod
-R
755
test_99
"chmod" is the program called
(=command), "-R" is the flag, and "755" and "test_99" are arguments.
This command tells the computer to change the permission level of
directory "test_99" and its subdirectories to "755" recursively.
- If output scrolls up on your terminal screen
faster than you can read it, you can suspend it by
typing . To resume the display, type .
will abort a process, and will discard
the output to the screen until another is entered.
Be sure to note that although the output doesn't appear, the
process is still running. suspends the current program.
You can resume the suspended program by giving the "fg" (foreground)
command, or resume it in the background with "bg."
Of course, you need to find program's process ID first using "ps" command.
Here's a quick summary of special keys that are
frequently used in Unix.
Key Combination |
It does |
Ctrl-h |
^h erases the last character on the command line.
(=Backspace key) |
Ctrl-c |
^c interrupts a command or process in progress
and returns to the command line. This will usually work;
if it doesn't, try typing several ^c's in a row. If
it still doesn't work, try typing ^\, q (for quit),
exit, ^d, or ^z. |
Ctrl-d |
^d generates an end-of-file character. It can
be used to terminate input to a program, or to end
a session with a shell, i.e., logout. |
Ctrl-s |
^s stops the flow of output on the display,
i.e., halt. To return back to the normal
state, use Ctrl-d (^q) |
Ctrl-u |
^u erases the entire command line. It is
also called the "line kill" character. |
Ctrl-w |
^w erases the last word on the command line. |
Ctrl-z |
^z suspends a command or process in progress. |
Ctrl-\ |
^\ quits a program and saves an image of the program
in a file called "core" for later debugging. |
|
- Unix is based on a multi-user computing environment. When you
start a Unix session on a workstation, you are placed in a directory
that contains your files. This directory is called your home
directory or login root directory. For example, a user "wclinton"
would have a home directory at "/home/wclinton." You can create,
copy, move, and remove files as well as create subdirectories that
reside in your home directory. However, you can not create, copy,
move, and remove files/subdirectories in other users' home directories,
because you do not have permissions on them.
- If you want to be proficient with Unix, you need to be
familiar with six basic elements of Unix. They are: commands, files,
directories, your environment, processes, and jobs. We will explore
each of these elements in a little greater detail later on, but
first you need to learn how to initiate a session on a Unix system.
|