Users, Interactive and Login shells Flashcards

1
Q

What configuration scripts are executed upon signing in through the login shell?

A

1 /etc/profile - sets up environment variables 2 ~/.bash_profile | ~/.bash_login | ~/.profile - first file executed, sets up user env variables 3 ~/.bashrc - sets up user created functions and command aliases 4 /etc/bashrc - sets up system wide functions and command aliases

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

What script will be executed at user logout if it exists?

A

~/.bash_logout *user defined commands can be placed here to perform actions at logout

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

What configuration scripts are executed upon opening a non login shell (interactive)?

A

1 ~/.bashrc - sets up user created functions and commands 2 /etc/bashrc - sets up system wide functions and command aliases

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

How do you modify the $PATH env variable?

A

append: PATH=$PATH:/directory prepend: PATH=/directory:$PATH

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

How do you create a variable and use it in other shells?

A

export VARIABLENAME

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

What is the structure that constitutes a command?

A

Command Option Argument i.e ls -l file

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

What is the command to create an alias?

A

alias =’’ i.e alias lr=’ls -R’

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

What is the command to remove a created alias?

A

unalias i.e unalias lr

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

How do you create a persistent alias?

A

Append alias to ~/.bashrc

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

How do you get a listing of shell and environment variables?

A

set

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

When using the su command, what denotes a login shell?

A
  • -l –login i.e su - *loads the env variables for the user
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is important to account for when running a script?

A

Script is run with under user with login shell, for instance if it depended on environment variables that were not present from interactive shell

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

How would you login as root without knowing the root user password?

A

sudo su

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

Add to path

A

export PATH=$PATH:/place/with/the/file

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

Make path permanent

A

Add the to ~/.bashrc

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

/etc/bashrc

A

/etc/bashrc - sets up system wide functions and command aliases

17
Q

~/.bashrc

A

~/.bashrc - sets up user created functions and command aliases

18
Q

/etc/profile

A

/etc/profile - sets up environment variables