Pt 2 Ch. 11 The Environment Flashcards

1
Q

What knowledge allows us to use the environment to customize our shell experience?

A

Some programs look for values stored in the environment to adjust their behavior.

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

The shell stores two basic types of data in the environment

A
  1. environment vaiables 2. shell variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s the best way to view the enviornment?

A

prinenv | less or set | less

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

How do set and printenv differ?

A

The set command shows both the shell and environment variables. Printenv shows only the latter

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

What does printenv show us?

A

A list of environment variables and their values

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

How can the printnenv command list the value of a specific variable?

A

printenv USER

me

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

What one element of the environment does neither set nor printenv display?

A

aliases

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

How do you see the aliases in the enivornment?

A

enter alias command without arguments

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

The name of the display if we are running a graphical environment.
Usually this is “:0”, meaning the first display generated by the X
server.

A

Display

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

The name of the program to be used for text editing.

A

EDITOR

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

The name of the user’s default shell program.

A

SHELL

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

The pathname of your home directory.

A

HOME

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

Defines the character set and collation order of your language.

A

LANG

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

The previous working directory.

A

OLDPWD

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

The name of the program to be used for paging output. This is often
set to /usr/bin/less.

A

PAGER

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

A colon-separated list of directories that are searched when we enter
the name of a executable program

A

PATH

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

This stands for “prompt string 1.” This defines the contents of the
shell prompt. As we will later see, this can be extensively
customized.

A

PS1

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

This stands for “prompt string 1.” This defines the contents of the
shell prompt. As we will later see, this can be extensively
customized.

A

PS1

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

The current working directory.

20
Q

The name of your terminal type. Unix-like systems support many
terminal protocols; this variable sets the protocol to be used with
your terminal emulator.

21
Q

Specifies your time zone. Most Unix-like systems maintain the
computer’s internal clock in Coordinated Universal Time (UTC)
and then display the local time by applying an offset specified by
this variable.

22
Q

USER

A

Your username

23
Q

What do startup files do

A

They define the default environment shared by all users. When we log on to the system, the bash program starts, and reads these series of configurations scripts.

24
Q

A session is one in which we are prompted for
our username and password. This happens when we start a virtual console session,
for example.

A

A login shell session

25
this session typically occurs when we launch a terminal session in the GUI. Login shells read one or more startup files as sh
A non-login shell session
26
A global configuration script that applies to all users
/etc/profile
27
A user's personal startup file. This can be used to extend | or override settings in the global configuration script.
~/.bash_profile
28
If ~/.bash_profile is not found, bash attempts to | read this script.
~/.bash_login
29
If neither ~/.bash_profile nor ~/.bash_login | is found, bash attempts to read this file. T
~/.profile
30
A global configuration script that applies to all users.
/etc/bash.bashrc
31
A user's personal startup file. It can be used to extend or | override settings in the global configuration script.
~/.bashrc
32
In addition to reading startup files non-login shells inherit
the environments from their parent process, usually a login shell
33
Using this technique, we can append text to the end of a variable's contents.
``` [me@linuxbox ~]$ foo="This is some " [me@linuxbox ~]$ echo $foo This is some [me@linuxbox ~]$ foo=$foo"text." [me@linuxbox ~]$ echo $foo This is some text. ```
34
The PATH variable is often (but not always, depending on the distribution) set by the / etc/profile startup file with this code:
PATH=$PATH:$HOME/bin
35
export PATH
the export command tells the shell to make the contents of PATH available to child processes of this shell
36
What changes should be placed in .bash_profile? or .profile?
if you are adding directories to your PATH or defining additional environment variables
37
what changes belong in .bashrc
any changes besides adding directories to your path or defining additional environment variables.
38
What allows us to modify the environment?
Knowing where the startup files are and what they contain
39
What program is used to edit the shell's startup files, as well as most of the other configuration files on the system
Text editor
40
Two basic categories of Text Editors
Graphical and text based.
41
How are text editors invoked from the command line?
By typing the name of the editor followed by the name of the file we want to edit
42
What's a safe computing practice whenever we edit an important configuration file?
Create a backup of the file first
43
How do we exist a text editor program?
Ctrl-X
44
How do we save work in a text editor program
ctrl-o
45
What happens if you add a # symbol in front of valid alias definitions in text editor?
You can deactivate a configuration line while preserving the information it contains
46
what section of the bash man page covers the bash startup files
INVOCATION