10 Shell and environment variables Flashcards

1
Q

Set variable to value:

A

variable=value

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

Make variable visible to called programs:

A

export variable

export variable=value

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

Modify environment variables for one command only:

A

variable1=value variable2=value command

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

shows all shell variables

A

set

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

shows all (exported) environment variables.

A

printenv

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

home directory

A

$HOME

~

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

Your login name.

A

$USER/$LOGNAME

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

Colon-separated list of directories in which shell looks for commands (e.g., “/bin:/usr/bin:/usr/X11R6/bin”).
Should never contain “.”, at least not at beginning. Why?

A

$PATH

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

Colon-separated list of directories where the loader looks for shared libraries (see man ld.so)

A

$LD_LIBRARY_PATH

.. C security issue

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

Locale

A

$LANG, $LC_*

Your “locale”, the name of a system-wide configuration file with information about your character set and language/country conventions (e.g., “en_GB.UTF-8”). $LC_* sets locale only for one category, e.g. $LC_CTYPE for character set and $LC_COLLATE for sorting order; $LANG sets default for everything. “locale -a” lists all available locales.

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

Specification of your timezone (mainly for remote users)

A

$TZ

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

Previous working directory, also available as “~-”

A

$OLDPWD

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

Change the command prompt

A

$PS1 — The normal command prompt, e.g.

$ PS1=’[\033[7m]\u@\h:\W !$[\033[m] ‘

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

Printers

A

$PRINTER — The default printer for lpr, lpq and lprm.

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

Terminal type

A

$TERM — The terminal type (usually xterm or vt100).

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

Pager/editor

A

$PAGER/$EDITOR — The default pager/editor (usually less and emacs, respectively).

17
Q

X server that clients shall use

A

X server - the program that has control over the screen

$DISPLAY

18
Q

environment variables documentation

A

man 7 environ