Bird
0
0

You want to create a script that adds a user with a home directory and then deletes the user along with all their files. Which commands should you use in order?

hard📝 Application Q15 of 15
Linux CLI - Users and Groups
You want to create a script that adds a user with a home directory and then deletes the user along with all their files. Which commands should you use in order?
Auseradd -m username; userdel -r username
Buseradd username; userdel username
Cuserdel -r username; useradd -m username
Duserdel username; useradd username
Step-by-Step Solution
Solution:
  1. Step 1: Add user with home directory

    Use useradd -m username to create the user and their home folder.
  2. Step 2: Delete user and all files

    Use userdel -r username to remove the user and their home directory and files.
  3. Final Answer:

    useradd -m username; userdel -r username -> Option A
  4. Quick Check:

    Add with -m, delete with -r for files [OK]
Quick Trick: Add with -m, delete with -r to remove files [OK]
Common Mistakes:
  • Deleting before adding user
  • Forgetting -m when adding user
  • Forgetting -r when deleting user

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes