Previous Table of Contents Next


UNIX ENVIRONMENT

The UNIX shell maintains an environment that controls how commands are interpreted and performed. A few of the more common environment variables and concepts are presented throughout the following paragraphs.

INPUT/OUPUT (I/O)

The UNIX System handles I/O as streams of data. The streams flow into and out of commands, files, or devices. The shell has three default types of I/O. The input stream is referred to as standard input and is usually generated by your terminal keyboard. The output stream is referred to as standard output and is usually displayed to your terminal screen. Standard error is error output from programs which also defaults to your terminal screen.

Standard Input/Output/Error

Conventional Names Default Device Input or
Output is Connected to
File Descriptor (Used by the Shell)

Standard Input Terminal Keyboard (or from a pipe of file) 0
Standard Output Terminal Screen (or to a pipe or file) 1
Standard Error Terminal Screen (or to a pipe or file) 2

REDIRECTION

The standard I/O can be redirected from your terminal to a file or a device. You can store data in files or send the contents to a command as input. Output from one command can be redirected to the input of another command. This is called "piping."

PATH NAMES

Pathnames are used to refer to directories and files not in the present working directory. A path is made up of a "/" followed by a subdirectory name or a filename, multiple "/" and subdirectories can be listed. Full pathnames begin with a "/", which denotes the root directory. Relative pathnames do not begin with a "/". Instead they start with a directory name or ".". There are several types of relative pahtnames. Subdirectory paths begin with the subdirectory's name, not a "/". Indirect paths begin with a "..", which allows dynamic backward movement within the file system.

1.  Change directories using a full pathname by typing >cd/usr/bin and pressing Return.
2.  Display the contents of the /usr/bin directory by typing ls -x and pressing Return. Your output may vary depending on the type of UNIX System you are using, but it should resemble the following.
   cj> ls -x
   300        300s     3bnstat  4014    450      Oar
   admin      asa      at       awk     b16as    b16cc
   b16ckfile  b16conv  b16cprs  b16dis  b16dump  b16ld
   .
   .
   .

BSD (Berkeley)
The output for BSD systems is slightly different.

3.  Return to your home directory by typing cd and pressing Return.

PRESENT WORKING DIRECTORY

The present working directory is often referred to as the current working directory or current directory. Since the command that returns the present working directory is "pwd," we will refer to it as such. The UNIX System has file systems that are hierarchical tree structures containing directories and files.

1.  Display the present working directory by typing pwd and pressing Return.
2.  To change the present working directory type cd .. and press Return. Notice that no response is given if the command worked.
3.  Display the present working directory by typing pwd and pressing Return. Notice you have moved up the directory path one position. The ".." refers to the previous or "parent" directory in the present working path.
4.  To return to your home directory, type cd and press Return.

HOME DIRECTORY

The system administrator created a directory for you somewhere in this hierarchy. When you log in you are positioned at this directory. This directory is known as your login or HOME directory. Since this is your home directory, you should own it and all the files under it. Therefore, you have full permissions to read, write, create, change, or delete the contents of your home directory.

TERMINAL TYPE

Certain UNIX commands must know what type of terminal you are using so they can interface with it correctly. You may need to contact your system administrator to find out what name UNIX uses for your terminal. The following steps show how to set your terminal type to a DEC VT100 terminal.

Other popular terminal types include:

adm3 adm5
ansi (pc) hp
tvi925 tvi955
vt52 vt220
wyse50 wyse60
1.  Type TERM=vt100 and press Return to set the TERM variable to vt100 for the current login shell.

C Shell
Type set term=vt100 and press Return to set the TERM variable to vt100 for the current login shell.

2.  Type export TERM and press Return to export the TERM variable to the global shell environment. This allows other sub process commands to use the TERM variable.

C Shell
The setenv command performs the same function as the SV export command. But the csh knows to export the term variable automatically.

3.  Type env and press Return. Notice that the TERM variable is listed as being set to vt100.
   cj> env
   LOGNAME=mylogin
   MAIL=/usr/mail/mylogin
   ENV=/u1/ts/mylogin/env.ksh
   HOME=/u1/ts/mylogin
   TERM=vt100
   PATH=:/bin:/usr/bin:/lbin:/usr/lbin:/u1/ts/mylogin/bin:.
   TZ=EST0EDT
   VISUAL=vi
   FCEDIT=vi
   SHELL=/bin/sh

C Shell
Type printenv to display environment variables.

SETTING/CHANGING YOUR PASSWORD

The passwd utility allows you to create or change the password associated with your user name. You can only change your password, you cannot change other users' passwords.

It is advisable to change your password the first time you log in on a multiuser system. Refer to Module 100 for a complete description of the passwd command.


Previous Table of Contents Next