Linux 2 Ch 1- Adv shell features Flashcards

(28 cards)

1
Q

&&

A

This is an AND list. If the command on the left side of && does execute successfully, then the command on the right side of && will execute.

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

.

A

Command used to re-execute a bash shell configuration file (.profile, .bashrc, etc.) after changes are made.

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

/etc/bash.bashrc

A

Systemwide configuration file read when a new shell starts. Contains variables, commands, and aliases common to all users.

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

/etc/profile

A

Systemwide bash configuration file read at login. Contains bash settings and environment variables common to all users.

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

A function is given 3 arguments as input. The third argument of a function is identified as:
$1
$3
$PATH
$arg3

A

$3

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

A login BASH shell executes which of the following additional files (compared to an interactive BASH shell)?
/etc/profile and either ~/.bash_profile or ~/.bash_login or ~/.profile
/etc/profile and ~/.bashrc
/etc/profile and /etc/bashrc
~/.bash_profile and ~/.bashrc.

A

/etc/profile and either ~/.bash_profile or

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

alias

A

alias and unalias utilities create or remove a nickname (shorthand term) for a command or series of commands.

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

Changes in the __________ initialization file will affect all the users on the system.
Local
Shell
Network
Global

A

Global

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

Defining the PS1 variable in an initialization file will not make changes to the prompt persistent between logins.
True or False?
True
False

A

False

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

env

A

Displays all environmental variables available to all shells.

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

export

A

With no arguments export displays all environmental variables available to all shells. export VARIABLE is used to export a locl variable.

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

function

A

Similar to an alias but for executing multiple commands. Typically used in bash shell scripts.

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

Once a variable is declared, it cannot be deleted.
True or False?

A

False

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

set

A

With no arguments set displays the values of all variables (local and environment) set in the current shell

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

source

A

Command used to re-execute a bash shell configuration file (.profile, .bashrc, etc.) after changes are made.

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

Sourcing is an effective way to test initialization file changes. Which of the following is used to source a file?
None of the above
The touch command
Either the period . character or the source command
The tilde ~ character

A

Either the period . character or the source command

17
Q

The ___________ command can be used to check if a command already exists.
command
type
ex
check

18
Q

The best way to group multiple commands and pass arguments is to:
Concatenate them
Use functions
Create an initialization file
Create an alias

A

Use functions

19
Q

unset

A

Removes the variable from the current shell and subshells.

20
Q

Which of the following is not a valid option for executing a command that is not in the directories listed in the PATH variable?
Add the directory containing the command to the PATH variable
Copy the command to a directory listed in the PATH
By typing the absolute or relative path to the command
Rename the command and its directory

A

Rename the command and its directory

21
Q

Which script is executed when you exit the shell?
~/.bashrc
/etc/bashrc
~/.bash_profile
~/.bash_logout

A

~/.bash_logout

22
Q

||

A

This is an OR list. If the command on the left side of || does NOT execute successfully, then the command on the right side of || is executed.

23
Q

~/.bash_login

A

A bash user configuration file used to customize the shell environment. Sourced if ~/.bash_profile does not exist. Includes global variables not defined in /etc/profile.

24
Q

~/.bash_logout

A

A bash user configuration file read at logout. Typically contains “clean up” commands such as clear to remove any text on the screen.

25
~/.bash_profile
A bash user configuration file used to customize the shell environment. If exists, it is sourced after /etc/profile. Includes global variables not defined in /etc/profile
26
~/.bashrc
A bash user configuration file read each time a new shell is started. Typically contains local variables, commands and aliases.
27
~/.profile
A bash user configuration file used to customize the shell environment. Sourced if neither ~/.bash_profile or ~/.bash_login does not exist. Includes global variables not defined in /etc/profile.
28
Command for the current desktop
echo $XDG_CURRENT_DESKTOP