20250406 Deck1 Flashcards

1
Q

What does -y do in commands like apt install or apt upgrade?

A

It stands for:

“yes to all prompts”

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

What is GPG?

A

A GPG (GNU Privacy Guard) key is a cryptographic key pair (public and private) used for encrypting, decrypting, and digitally signing data and communications, ensuring authenticity and integrity

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

groups command in Linux?

A

Shows all the groups that your current user belongs to

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

What does the -aG flag combination do in the command sudo usermod -aG docker user?

A

-aG appends the user to supplementary groups (like docker).

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

Why is the -a important in the command sudo usermod -aG docker user?

A

-a (append) ensures the user is added to the group without removing existing group memberships.

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

What happens if the -a flag is omitted in the command sudo usermod -G docker user?

A

Omitting -a would overwrite the user’s current group list.

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

After running sudo usermod -aG docker user, why might the user still not be able to run docker without sudo?

A

The group change doesn’t affect the current session.

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

How can the user activate the new group immediately without logging out after using sudo usermod -aG docker user?

A

The user can run newgrp docker, which starts a new shell with docker as the active group.

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

What does the command groups do?

A

Shows groups for the current user/session.

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

What information does the command id user provide?

A

Shows UID, GID, and groups for a specified user.

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

What is the purpose of the command newgrp docker?

A

Starts a new shell where docker becomes the active group, allowing group changes to apply without logging out.

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

What does $USER represent in the command sudo usermod -aG docker $USER?

A

$USER is a shell variable that expands to the currently logged-in username.

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

When should you avoid using $USER in the command sudo usermod -aG docker $USER?

A

You should avoid using it when modifying another user’s account—use their actual username instead (e.g. john).

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

What does the command echo $USER do?

A

It prints the value of the $USER environment variable

It shows the original login user when you log in.

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

What is the output of echo $USER if the login user is alice?

A

alice

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

What does the command whoami do?

A

It prints the effective username of the current process

It checks the actual user ID (UID) the process is running under.

17
Q

What is the output of whoami if the current user is alice?

18
Q

What happens when you run sudo whoami?

A

It shows root

This indicates that you are running as the root user.

19
Q

What happens when you run sudo echo $USER?

A

It shows alice

The environment variable $USER has not changed.

20
Q

When does echo $USER and whoami differ?

A

When using sudo

whoami shows root, while echo $USER shows the original login user.

21
Q

What does echo $USER show?

A

Login username (env variable)

22
Q

What does whoami show?

A

Effective current user