20250406 Deck1 Flashcards
What does -y do in commands like apt install or apt upgrade?
It stands for:
“yes to all prompts”
What is GPG?
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
groups command in Linux?
Shows all the groups that your current user belongs to
What does the -aG
flag combination do in the command sudo usermod -aG docker user
?
-aG
appends the user to supplementary groups (like docker
).
Why is the -a
important in the command sudo usermod -aG docker user
?
-a
(append) ensures the user is added to the group without removing existing group memberships.
What happens if the -a
flag is omitted in the command sudo usermod -G docker user
?
Omitting -a
would overwrite the user’s current group list.
After running sudo usermod -aG docker user
, why might the user still not be able to run docker
without sudo
?
The group change doesn’t affect the current session.
How can the user activate the new group immediately without logging out after using sudo usermod -aG docker user
?
The user can run newgrp docker
, which starts a new shell with docker
as the active group.
What does the command groups
do?
Shows groups for the current user/session.
What information does the command id user
provide?
Shows UID, GID, and groups for a specified user.
What is the purpose of the command newgrp docker
?
Starts a new shell where docker
becomes the active group, allowing group changes to apply without logging out.
What does $USER represent in the command sudo usermod -aG docker $USER?
$USER is a shell variable that expands to the currently logged-in username.
When should you avoid using $USER in the command sudo usermod -aG docker $USER?
You should avoid using it when modifying another user’s account—use their actual username instead (e.g. john).
What does the command echo $USER do?
It prints the value of the $USER environment variable
It shows the original login user when you log in.
What is the output of echo $USER if the login user is alice?
alice
What does the command whoami do?
It prints the effective username of the current process
It checks the actual user ID (UID) the process is running under.
What is the output of whoami if the current user is alice?
alice
What happens when you run sudo whoami?
It shows root
This indicates that you are running as the root user.
What happens when you run sudo echo $USER?
It shows alice
The environment variable $USER has not changed.
When does echo $USER and whoami differ?
When using sudo
whoami shows root, while echo $USER shows the original login user.
What does echo $USER show?
Login username (env variable)
What does whoami show?
Effective current user