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.

A

PWD

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.

A

TERM

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.

A

TZ

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
Q

this session typically occurs when we launch a terminal session in the GUI.
Login shells read one or more startup files as sh

A

A non-login shell session

26
Q

A global configuration script that applies to all users

A

/etc/profile

27
Q

A user’s personal startup file. This can be used to extend

or override settings in the global configuration script.

A

~/.bash_profile

28
Q

If ~/.bash_profile is not found, bash attempts to

read this script.

A

~/.bash_login

29
Q

If neither ~/.bash_profile nor ~/.bash_login

is found, bash attempts to read this file. T

A

~/.profile

30
Q

A global configuration script that applies to all users.

A

/etc/bash.bashrc

31
Q

A user’s personal startup file. It can be used to extend or

override settings in the global configuration script.

A

~/.bashrc

32
Q

In addition to reading startup files non-login shells inherit

A

the environments from their parent process, usually a login shell

33
Q

Using this technique, we can append text to the end of a variable’s contents.

A
[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
Q

The PATH variable is often (but not always, depending on the distribution) set by the /
etc/profile startup file with this code:

A

PATH=$PATH:$HOME/bin

35
Q

export PATH

A

the export command tells the shell to make the contents of PATH available to child processes of this shell

36
Q

What changes should be placed in .bash_profile? or .profile?

A

if you are adding directories to your PATH or defining additional environment variables

37
Q

what changes belong in .bashrc

A

any changes besides adding directories to your path or defining additional environment variables.

38
Q

What allows us to modify the environment?

A

Knowing where the startup files are and what they contain

39
Q

What program is used to edit the shell’s startup files, as well as most of the other configuration files on the system

A

Text editor

40
Q

Two basic categories of Text Editors

A

Graphical and text based.

41
Q

How are text editors invoked from the command line?

A

By typing the name of the editor followed by the name of the file we want to edit

42
Q

What’s a safe computing practice whenever we edit an important configuration file?

A

Create a backup of the file first

43
Q

How do we exist a text editor program?

A

Ctrl-X

44
Q

How do we save work in a text editor program

A

ctrl-o

45
Q

What happens if you add a # symbol in front of valid alias definitions in text editor?

A

You can deactivate a configuration line while preserving the information it contains

46
Q

what section of the bash man page covers the bash startup files

A

INVOCATION