1.3 Environment Variables Flashcards

2
Q

How do you preserve the current value of the PATH environment variable when adding a new value to it?

A

To preserve the current value of the PATH environment variable when appending paths to it, put $PATH. For example, PATH=$PATH:/additional/path.

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

What are the two different types of variables?

A

The two different types of varables are user-defined variables and environment variables.

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

What is a user-defined variable?

A

Variables assigned with a name and contents of your choice. Does not change the shell environment or how the shell works.

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

What is an environment variable?

A

An environment variable is a setting that the operating system or programs working in the operating system access. Environment variables make up the user environment.

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

What is the standard for environment variable names?

A

The standard for writing variables names (called variable identifiers) is to use all upper-case letters (e.g., SHELL and EUID).

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

What do environment variables become when you change them from the defaults?

A

Changing environmental variables from the defaults result in user-defined variables.

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

What is a user-defined variable?

A

A user-defined variable is a variable that applies only to the current session.

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

How do you make a user-defined environement variable apply to child sessions?

A

Exporting user-defined variables makes them apply to child sessions.

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

How do you make user-defined environment variables persistent?

A

Add user-defined variables to the shell configuration files to make them persistent.

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

What does the BASH environment variable contain?

A

The BASH environment variable contains the location of the bash executable file.

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

What does the SHELL environment variable contain?

A

The SHELL environment variable contains the user’s login shell.

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

What does the CPU environment variable contain?

A

The CPU environment variable contains the type of CPU.

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

What does the DISPLAY environment variable contain?

A

The DISPLAY environment variable contains the location where X Windows output goes. Can be used to send X-windows output to another machine.

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

What does the ENV environment variable contain?

A

The ENV environment variable contains the location of the configuration file for the current shell.

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

What does the EUID environment variable contain?

A

The EUID environment variable contains the ID number of the current user.

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

What does the HISTFILE environment variable contain?

A

The HISTFILE environment variable contains the filename where past commands are stored. For Bash, it’s usually ~/.bash_history.

18
Q

What does the HISTSIZE environment variable contain?

A

The HISTSIZE environment variable contains the number of past commands that HISTFILE stores for the current session.

19
Q

What does the HISTFILESIZE environment variable contain?

A

The HISTFILESIZE environment variable contains the number of past commands that HISTFILE stores for the multiple sessions.

20
Q

What does the HOME environment variable contain?

A

The HOME environment variable contains the absolute path of the user’s home directory.

21
Q

What does the HOST environment variable contain?

A

The HOST environment variable contains the name of the computer.

22
Q

What does the HOSTNAME environment variable contain?

A

The HOSTNAME environment variable contains the name of the computer. It is identical to HOST, but used on certain distributions.

23
Q

What does the INFODIR environment variable contain?

A

The INFODIR environment variable contains the path to the computer’s information pages.

24
Q

What does the LOGNAME environment variable contain?

A

The LOGNAME environment variable contains the user name of the current user.

25
Q

What does the MAIL environment variable contain?

A

The MAIL environment variable contains the path to the current user’s mailbox file. Usually /var/spool/mail/username.

26
What does the **MANPATH** environment variable contain?
The **MANPATH** environment variable contains the path to the computer's man pages. Usually **/usr/local/man**.
27
What does the **OLDPWD** environment variable contain?
The **OLDPWD** environment variable contains the path of the directory the user was in prior to the current path.
28
What does the **OSTYPE** environment variable contain?
The **OSTYPE** environment variable contains the type of operating system. Usually this is Linux.
29
What does the **PATH** environment variable contain?
The **PATH** environment variable contains the directory prefixes used to search for programs and files: * Use a colon (:) to separate entries in the **PATH** variable. * Do not include a period (.) in the **PATH** variable. A period indicates that the working directory is in the path, and this poses a security risk.
30
What does the **PS1** environment variable contain?
The **PS1** environment variable contains the characters the shell uses to indicate normal user ($), root user (#) and similar items.
31
What does the **PWD** environment variable contain?
The **PWD** environment variable contains the path of the current working directory.
32
What does the **LANG** environment variable contain?
The **LANG** environment variable contains the language the operating system uses.
33
What does the **PAGER** environment variable contain?
The **PAGER** environment variable contains used by the man command to specify the program in which to display man pages.
34
What does the command **echo $variable** do?
Views the variable's value.
35
What does the command **env** do?
Displays names and values only for environment variables applied to child sessions. In other words, variables that have been **export**ed.
36
What does the command **set** do?
Sets or displays shell environment variables. Without options, displays names and values of all environment variables on the system.
37
What does the command **unset variable** do?
Removes an environment variable.
38
What does the command **VARIABLE=value** do?
Creates a user-defined environment variable.
39
What does the command **export variable** do?
Exports a user-defined variable to make it available to child sessions.
40
How do you append information to an existing environment variable?
To append information to an environment variable, put the current variable in the command. For example, **PATH=$PATH:/bin/***additionalpath*.