Topic 7 - Unix Shell Environments Flashcards Preview

CS 2211 - Unix > Topic 7 - Unix Shell Environments > Flashcards

Flashcards in Topic 7 - Unix Shell Environments Deck (44):
1

HOME

the full path name of your home directory

2

SHELL

the name of your login shell

3

PWD

the full path of the current working directory

4

USER

the user name of the logged in user

5

TERM

the kind of terminal the user is using

6

DISPLAY

which X server to display on

7

PATH

the directories the shell should search to find a command

8

HOST

the name of e the computer you are using

9

REMOTEHOST

the name of the host logged-in from

10

MANPATH

the directories the man command should search to find man pages

11

Shell variable names can be made up of:

Alphabetical characters
Digits
Underscores

12

Shell variable names cannot begin with:

a digit

13

Shell variables can store either:

string of characters, or NULL

14

Shell variables can be accessed by putting a ____ in front of ____

putting a $ in front of their names. e.g., echo $HOME

15

Are variable names case-sensitive?

yes

16

What are the two kinds of shell variables?

Environmental variables (GLOBAL) & Regular Variables (LOCAL)

17

Define environmental variables

Affecting the current shell and the programs invoked from the shell.

18

Define regular variables

Affecting the current shell, but not the programs invoked from the shell

19

Which type of shells define their shell variables in each of the following:
- .profile
- .cshrc and .login

.profile = Bourne-Style shells
.cshrc and .login = C-Style shells

20

C-Style Shells: How do you set a variable?

set varname=varvalue

21

C-Style Shells: Clearing a regular (local) variable?

unset varname

22

C-Style Shells: How do you set environment variables?

setenv EnvironemntVarialbe EnvironemntValue **No "=" sign here!**

23

C-Style Shells: How do you clear environment variables?

unsetenv EnvironemntVariable

24

C-Style Shells: How do you list all environment shell variables?
Regular shell variables?

1) "printing" or "env"
2) "set" without any arguments

25

Bourne-Style Shells: How do you set a regular (local) variable?

varname=varvalue (there is no "set" here - also, no spaces before / after "=" !!!)

26

Bourne-Style Shells: How do you clear regular (local) variable?

unset varname (same as C-Style Shell)

27

Bourne-Style Shells: How do you set an environmental variable?

Same as local variable (EnvironmentVariable = EnviromentValue)
Then, use "export EnvironmentVariable"

28

Bourne-Style Shells: How do you clear an environmental variable?

unset EnvironmentVaraible (only 'unset' - same as regular variables)

29

Bourne-Style Shells: How do list all local variables? Environmental variables?

"set" - lists ALL existing local AND enviro variables
"print env or just env" will list ONLY enviro (exported) shell variables

30

Once a variable is exported, the only way to stop the export effect is to _____

"unset" the variable

31

The shell searches in each directory of $Path how?

In left to right order and executers the first version.

32

What does "which" cmd do?

locates a unix command and displays its pathname or alias

33

What does .login do?

Runs once when you log in: contains one-time things like terminal setup

34

What does .cshrc do?

Runs before the execution of any [t]csh process: Sets lots of variables, e.g., PATH, MANPATH etc.

35

In C-Style shells, what does "history" cmd do?

Displays the command history list with line numbers

36

List the ways to rerun a command line in the history:

1) !! - reruns last command
2) !str - returns the latest command beginning with str
3) !n - where n is a number; reruns command number n in the history list

37

The variable savehist determines:

How much history to be saved in the file name histfile for your next session;

38

Where are savehist and hostile variables likely to be set?

In C-Style shells: in your .cshrc file. Example:
set history=24
set savehist=10
set histfile=$home/.history.$HOSTTYPE

39

What is the "alias" cmd syntax?

alias alias-name real-command

40

Can you put your aliases in your .cshrc file?

Yes

41

Can you display the alias of a command using the which command?

Yes.

42

What does the alias command without any arguments do?

Lists ALL existing aliases.

43

How do you delete alias(s)?

Using the "unalias" cmd: unalias alias-anem

44

C-Style shells has command and filename completion where you can let the shell complete a long command name - how do you use this feature?

Type a prefix of a command (only the first few letters), then hit the TAB key: the shell will fill in the rest for you, if possible. Same with filenames.