105.1 Lesson 1 Flashcards

1
Q

Is a tty a login shell?

A

yes

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

What is the command in the output of ps aux | grep bash for pts bash?

A

bash

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

Which Bash specific file configures the user environment?

A

~/.bash_profile

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

Which files can ~/.bash_profile source?

A

~/.bash_login and ~/.profile

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

Which file will be executed if there is no ~/.bash_profile?

A

~/.bash_login

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

Is ~/.profile Bash specific?

A

no

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

When is ~/.profile sourced?

A

when neiter ~/.bash_profile nor ~/.bash_login exist.

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

Which file does ~/.profile source?

A

~/.bashrc

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

Which Bash specific file does clean-up operations when exiting the shell?

A

~/.bash_logout

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

Which file is run first when starting a shell: /etc/profile or ~/.profile?

A

/etc/profile

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

Where is an interactive Non-Login Bash configured globally?

A

/etc/bash.bashrc

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

Where is an interactive Non-Login Bash configured locally?

A

~/.bashrc

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

Which file does ~/.bashrc source?

A

~/.bash_aliases

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

How can bash be invoked as an non-interactive shell?

A

bash script.sh

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

Force a non-interactive bash shell to behave like a login shell!

A

bash -l script.sh

bash –login script.sh

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

How do you test if /etc/profile and ~/.profile are executed when running a shell?

A

Add an echo statement

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

Which files are loaded when a user logs into a machine via ssh?

A

/etc/profile

~/.profile

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

Where do scripts look for a startup file?

A

in the environment variable BASH_ENV

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

What does su do?

A

Execute commands with the privileges of another user account.

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

What does su do when no user id is specified?

A

Uses the superuser account.

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

Whats the difference between
su jane
su - jane

A

su - jane
starts a login shell. The login shell loads janes environment. The environment is not loaded when using
su jane

22
Q

List the synomys to

su -

A

su -l

su –login

23
Q

What does !$ expand to in a bash command?

A

the last argument of the previous command

24
Q

How do you source the file ~/.bashrc?

A

. ~/.bashrc

source ~/.bashrc

25
What does the skel directory contain?
A template for the file system structure of user's home directories.
26
Where is the variable SKEL defined?
/etc/adduser.conf
27
Where are the configuration files for shells configured?
In the skel directory.
28
What does echo$0 output in a login shell?
-bash or -su
29
What does echo $0 output in a non-login shell?
bash or /bin/bash
30
Use sudo to launch an interactive login shell as user2!
sudo su - user2 sudo su -l user2 sudo su --login user2
31
Use su to launch an interactive login shell as root!
su - | su - root
32
Run an interactive-non-login shell as root using su
su root | su
33
When do you need to use sudo su?
When the root user is disabled for security reasons. E.G. Ubuntu
34
Is /etc/profile read when an interactive login shell is started as root?
yes
35
Is /etc/bash.bashrc read when an interactive login shell is started as root?
yes
36
Is ~/.profile read when an interactive login shell is started as root?
no
37
is ~/.bashrc read when an interactive login shell is started as root?
no
38
is /etc/profile read when an interactive non-login shell is started as root?
no
39
Is /etc/bash.bashrc read when an interactive non-login shell is started as root?
yes
40
Is /etc/profile read when an interactive non-login shell is started as user2?
no
41
Is /etc/bash.bashrc read when an interactive non-login shell is started as user2?
yes
42
Is ~/.profile read when an interactive non-login shell is started as user2?
no
43
Is ~/.bashrc read when an interactive non-login shell is started as user2?
yes
44
What is a superuser?
A special user account used for system administration.
45
What defines the superuser on Unix-like systems?
Her/His user identifier (UID) is zero.
46
Where do you put code that should be executed every time user2 opens a terminal from an X Window session?
/home/user2/.bashrc
47
Which type of shell is a terminal opened from an X Window session?
interactive non-login
48
Where is the skel directory?
/etc/skel
49
Why does a tty not source /etc/bash.bashrc or ~/.bashrc?
Because a login shell runs .bash_profile. bashrc can but must not be sourced from there
50
Which command modifies a user account?
usermod
51
Which command deletes a user?
deluser
52
Which command adds a user?
adduser