1 startup files how to customize your unix login shell

12
1 Startup Files How to customize your Unix login shell.

Upload: emory-underwood

Post on 13-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Startup Files How to customize your Unix login shell

1

Startup Files

How to customize your Unix login shell.

Page 2: 1 Startup Files How to customize your Unix login shell

2

Shells

Remember that you always interact with a Unix system through a shell.

Alphas by default use the EZ-shell. This can be changed.

chsh [user name]

Many different shells exist: C-shell, korn shell, bourn shell, t-shell, ez-shell, etc.

Page 3: 1 Startup Files How to customize your Unix login shell

3

Initialization files (Control files)

Files that are used at the start of a login or the start of a program.

Like preference files on Macs or PCs. .login .cshrc .forward .plan .pinerc .elm .emacs

Page 4: 1 Startup Files How to customize your Unix login shell

4

Login and Shell Initialization Files

Two types of startup files login initialization files which execute every time you log

into the computer. shell initialization files which execute every time you

start a new shell.

In practice, you really only need to modify your shell initialization file.

Page 5: 1 Startup Files How to customize your Unix login shell

5

Variables

Two kinds of variables exist: Environmental variables

Exist system wide. Used by the system to allow it to work properly.

User-created variables A user can create his or her own variables. Also called “aliases” which are shortcuts to commands.

Page 6: 1 Startup Files How to customize your Unix login shell

6

The C-shell

.login file used to set variables once per login.

.cshrc file used to set variables for each shell.

Not much difference between the two. Best to modify just your .cshrc file. Make a backup copy of your .cshrc file before

modifying it!

Page 7: 1 Startup Files How to customize your Unix login shell

7

Listing Environmental Variables

setenv Lists the current environmental variables for your

login. Common ones include:

TERM, HOME, SHELL, MAIL, PATH

Note the UPPERCASE

Page 8: 1 Startup Files How to customize your Unix login shell

8

C-shell Special Variables

In addition to environmental variables, the C-shell has its own special variables. set

Include things like: history, noclobber, editmode, term, home, path, etc.

Note the lowercase.

Page 9: 1 Startup Files How to customize your Unix login shell

9

Setting Environmental Variables

Simple format: setenv [variable name] [value]

Can be set from the command line or from the .cshrc file.

Make sure you make a backup of your .cshrc file before changing it!

Page 10: 1 Startup Files How to customize your Unix login shell

10

Setting Special Variables

Simple format: set [variable name] = [value]

Can be set from the command line or from the .cshrc file.

Make sure you make a backup of your .cshrc file before changing it!

Note that special variables will override environmental variables.

Page 11: 1 Startup Files How to customize your Unix login shell

11

Aliases

Alias is an alternate name for a command. Can create them on the command line or in

your .cshrc file. Like variables, when created from the command

line, they exist only for that login. Format:

alias [name] [“command”]

Can be especially useful for changing default behavior for common commands.

Page 12: 1 Startup Files How to customize your Unix login shell

12

Reading

Chapters 25 and 27. We are done, take the exam.