Topic 7 - Unix Shell Environments Flashcards

1
Q

the full path name of your home directory

A

$HOME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

the name of your login shell

A

$SHELL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

the full path of the current working directory

A

$PWD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

USER

A

the user name of the logged in user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

TERM

A

the kind of terminal the user is using

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

DISPLAY

A

which X server to display on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

PATH

A

the directories the shell should search to find a command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

HOST

A

the name of e the computer you are using

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

REMOTEHOST

A

the name of the host logged-in from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

MANPATH

A

the directories the man command should search to find man pages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Shell variable names can be made up of:

A

Alphabetical characters
Digits
Underscores

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Shell variable names cannot begin with:

A

a digit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Shell variables can store either:

A

string of characters, or NULL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Are variable names case-sensitive?

A

yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the two kinds of shell variables?

A

Environmental variables (GLOBAL) & Regular Variables (LOCAL)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Define environmental variables

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Define regular variables

A

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

19
Q

Which type of shells define their shell variables in each of the following:

  • .profile
  • .cshrc and .login
A

.profile = Bourne-Style shells

.cshrc and .login = C-Style shells

20
Q

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

A

set varname=varvalue

21
Q

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

A

unset varname

22
Q

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

A

setenv EnvironemntVarialbe EnvironemntValue No “=” sign here!

23
Q

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

A

unsetenv EnvironemntVariable

24
Q

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

A

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.