Delete Flashcards

(19 cards)

1
Q

What is the purpose of delete commands in Linux?

A

To safely remove users and groups from the system

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

Name commands for deleting users and groups.

A

userdel, deluser, groupdel

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

What does userdel do?

A

Permanently removes a user account from the system

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

Syntax for userdel?

A

userdel [options] username

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

Example of userdel?

A

sudo userdel -r emma

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

What does -r option in userdel do?

A

Removes the home directory and mail spool

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

Exit codes for userdel?

A

0 success, 1 cannot update files, 2 invalid syntax, 6 user does not exist, 8 user is logged in

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

Command to check exit code?

A

echo $?

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

What does deluser do?

A

User-friendly wrapper script to remove users (common on Debian-based systems)

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

Syntax for deluser?

A

deluser [options] username

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

Example of deluser?

A

sudo deluser emma

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

Does deluser remove home directory by default?

A

No, use –remove-home to delete it

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

Why use deluser?

A

Provides readable output and additional checks

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

What does groupdel do?

A

Deletes a group from the system

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

Syntax for groupdel?

A

groupdel [options] groupname

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

Example of groupdel?

A

sudo groupdel marketing

17
Q

When can groupdel fail?

A

If the group is assigned as a primary group

18
Q

Exit codes for groupdel?

A

0 success, 2 invalid syntax, 6 group does not exist, 8 permission denied, 10 group is primary for a user

19
Q

Example error for groupdel?

A

groupdel: cannot remove the primary group of user ‘lisa’