Embed
Email

custom

Document Sample

Shared by: cuiliqing
Categories
Tags
Stats
views:
1
posted:
10/28/2011
language:
English
pages:
15
Introduction to UNIX



G. Customizing the UNIX

Environment







June 1, 1999 Customizing the UNIX Environment 1

Customizing the UNIX Environment

Performance Objectives

1. Describe the purpose of "Dot" files

2. Add a path variable to the .cshrc file

3. Re-source a dot file (source)

4. Define basic Shell Variables (PATH, SHELL, TERM, HOME)

5. Define the minimal content for the .login File (stty, setenv)

6. View Your Environment (env, stty all)

7. List aliases.

8. Temporarily disable an alias (unalias).

9. Change C-shell features with toggles (noclobber, ignoreeof, notify)







June 1, 1999 Customizing the UNIX Environment 2

Customizing Your Environment

• “Dot” files define the environment.

• Usually in your home directory.

• The .login is executed only once at log in.

• The .cshrc is executed for each C-Shell.

• The .pinerc file defines the mail environment.

• The .forward file routes mail to another host.







June 1, 1999 Customizing the UNIX Environment 3

What happens when you log in?

• You enter a login name and password.

• If the default shell is /usr/bin/tcsh, the T-Shell

is set as your command interpreter.

• The T-Shell executes the commands in your

~/.cshrc file or ~/.tcshrc file.

• Then the T-Shell executes the commands in

your ~/.login file.



June 1, 1999 Customizing the UNIX Environment 4

Content of .cshrc

• A typical .cshrc file contains:

 set path=(. ~/bin /usr/ucb /usr/bin /usr/local/bin)

 set term=vt100



 set history=30



 set ignoreeof



 alias rm rm -i



 alias lo logout









June 1, 1999 Customizing the UNIX Environment 5

Content of .login

• A typical .login file contains:

 stty erase ^H (tset -I -Q -e^H -k^U)

 setenv EDITOR vi



 setenv PRINTER lw









June 1, 1999 Customizing the UNIX Environment 6

Changing “dot” Files

• Templates are placed in new mode accounts

• Configuration changes made interactively

are valid only for the current session.

• Changes made to .login or .cshrc are not

active in the system until that file is

"sourced":

host% source .login





June 1, 1999 Customizing the UNIX Environment 7

Environment Commands

• setenv sets global environment variables:

 setenv VARIABLE value

• stty sets terminal I/O characteristics:

 stty option

• set defines predefined variables:

 set variable=value

• alias redefines commands:

 alias name “command list”

June 1, 1999 Customizing the UNIX Environment 8

Displaying Global Environment

• printenv displays values of global

environment variables.

host% printenv (environment of login session)

HOME=/scc/users/chttspit

SHELL=/bin/csh

TERM=vt100

USER=chttspit

PATH=.:/scc/users/chttspit/bin:/usr/ucb:/usr/bin:/usr/local/bin

LOGNAME=chttspit

PWD=/usr/local/scc/stts

EDITOR=vi





June 1, 1999 Customizing the UNIX Environment 9

Display the Local Environment

• set displays C-Shell's local variables.

host% set (environment "local" to current shell)

cwd /usr/local/scc/stts

history 30

ignoreeof (cannot use ^D to logout)

noclobber (confirmation of file redirect overwrite)

noglob (metacharacters * [] {} ? ~ not expanded)

path (. /scc/users/chttspit/bin /usr/ucb /usr/bin … )

shell /bin/csh

term vt100

user chttspit



June 1, 1999 Customizing the UNIX Environment 10

Display Terminal Characteristics

• Use stty to display terminal characteristics.

host% stty

speed 9600 baud; evenp

erase = ^H

-inpck imaxbel -tab

crt

Special Characters

erase ^H

kill ^U

intr ^C

eof ^D

June 1, 1999 Customizing the UNIX Environment 11

Displaying Aliases

• Use alias to display all aliases.

host% alias

lo logout

rm rm -i

• Use unalias to deactivate an alias:

host% unalias rm









June 1, 1999 Customizing the UNIX Environment 12

C Shell Toggles - noclobber

• Produces an error if

 redirects (>) are made to existing files

 appends (>>) are made to non-existing file





• Can be used interactively with set and unset

• Can be put into .login or .cshrc

• Presence can be viewed with set command



June 1, 1999 Customizing the UNIX Environment 13

C Shell Toggles

• ignoreeof -- Shell ignores EOF from

terminals. Protects against accidentally killing

a C shell by typing CTRL-D.

• noglob -- Inhibits filename substitution. Used

in scripts once filenames are obtained and no

further expansion is desired.

• notify -- Shell notifies you as jobs are

completed, rather than waiting until a prompt.

June 1, 1999 Customizing the UNIX Environment 14

End of Module

Complete Customizing the UNIX Environment

Exercises









June 1, 1999 Customizing the UNIX Environment 15



Related docs
Other docs by cuiliqing
7 Recipes from Joe A.
Views: 0  |  Downloads: 0
Re-installingXPMode
Views: 0  |  Downloads: 0
telefonica_en
Views: 0  |  Downloads: 0
3220 Chap 6 demos
Views: 0  |  Downloads: 0
chap history.docx
Views: 1  |  Downloads: 0
Subcontractor Bid Form - The Fountains
Views: 0  |  Downloads: 0
English
Views: 0  |  Downloads: 0
DESIGNER'S SCHEDULE USE
Views: 0  |  Downloads: 0
Security Service Providers
Views: 44  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!