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
Q

What does the skel directory contain?

A

A template for the file system structure of user’s home directories.

26
Q

Where is the variable SKEL defined?

A

/etc/adduser.conf

27
Q

Where are the configuration files for shells configured?

A

In the skel directory.

28
Q

What does echo$0 output in a login shell?

A

-bash or -su

29
Q

What does echo $0 output in a non-login shell?

A

bash or /bin/bash

30
Q

Use sudo to launch an interactive login shell as user2!

A

sudo su - user2
sudo su -l user2
sudo su –login user2

31
Q

Use su to launch an interactive login shell as root!

A

su -

su - root

32
Q

Run an interactive-non-login shell as root using su

A

su root

su

33
Q

When do you need to use sudo su?

A

When the root user is disabled for security reasons. E.G. Ubuntu

34
Q

Is /etc/profile read when an interactive login shell is started as root?

A

yes

35
Q

Is /etc/bash.bashrc read when an interactive login shell is started as root?

A

yes

36
Q

Is ~/.profile read when an interactive login shell is started as root?

A

no

37
Q

is ~/.bashrc read when an interactive login shell is started as root?

A

no

38
Q

is /etc/profile read when an interactive non-login shell is started as root?

A

no

39
Q

Is /etc/bash.bashrc read when an interactive non-login shell is started as root?

A

yes

40
Q

Is /etc/profile read when an interactive non-login shell is started as user2?

A

no

41
Q

Is /etc/bash.bashrc read when an interactive non-login shell is started as user2?

A

yes

42
Q

Is ~/.profile read when an interactive non-login shell is started as user2?

A

no

43
Q

Is ~/.bashrc read when an interactive non-login shell is started as user2?

A

yes

44
Q

What is a superuser?

A

A special user account used for system administration.

45
Q

What defines the superuser on Unix-like systems?

A

Her/His user identifier (UID) is zero.

46
Q

Where do you put code that should be executed every time user2 opens a terminal from an X Window session?

A

/home/user2/.bashrc

47
Q

Which type of shell is a terminal opened from an X Window session?

A

interactive non-login

48
Q

Where is the skel directory?

A

/etc/skel

49
Q

Why does a tty not source /etc/bash.bashrc or ~/.bashrc?

A

Because a login shell runs .bash_profile. bashrc can but must not be sourced from there

50
Q

Which command modifies a user account?

A

usermod

51
Q

Which command deletes a user?

A

deluser

52
Q

Which command adds a user?

A

adduser