Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam LFCS topic 1 question 48 discussion

Actual exam question from Linux Foundation's LFCS
Question #: 48
Topic #: 1
[All LFCS Questions]

A user accidentally created the subdirectory \dir in his home directory. Which of the following commands will remove that directory?

  • A. rmdir '~/\dir'
  • B. rmdir "~/\dir"
  • C. rmdir ~/'dir'
  • D. rmdir ~/\dir
  • E. rmdir ~/\\dir
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Greenmile84
3 months, 1 week ago
I've checked this in Alma and Ubuntu and only rm -d dir/ worked for me, some ideas?
upvoted 1 times
...
EliteAllen
4 months, 1 week ago
Selected Answer: E
E. rmdir ~/\\dir => is correct. ~ is expanded to the user's home directory. The double backslash \\ is used to escape the backslash character in the directory name \dir, ensuring that the directory name is interpreted correctly by the shell.
upvoted 1 times
...
karmasutras
7 months, 1 week ago
Selected Answer: E
E is correct. The incor rect comments are doing mkdir \dir which just makes directory named dir If you do mkdir "\dir" then you need to use option E to remove it.
upvoted 1 times
...
Jack67
10 months, 2 weeks ago
Selected Answer: D
E is the correct answer. I tested it and checked the result
upvoted 1 times
...
cezmaj
1 year, 1 month ago
Selected Answer: D
100% D. E doesn't work on Centos
upvoted 1 times
...
mksarav
1 year, 3 months ago
E is the correct answer. Tested and verified.
upvoted 1 times
...
Buruguduystunstugudunstuy
1 year, 3 months ago
Selected Answer: D
The command that will remove the subdirectory '\dir' in the user's home directory is 'rmdir ~/\dir'. Option D is the correct answer. The 'rmdir' command is used to remove empty directories. It takes a single directory name as an argument and removes the specified directory if it is empty. In this case, the subdirectory '\dir' is located in the user's home directory. To specify the path to the subdirectory, you can use the '~' symbol, which represents the user's home directory. To remove the subdirectory '\dir', you can use the following command: rmdir ~/\dir This command will remove the subdirectory '\dir' in the user's home directory if it is empty.
upvoted 1 times
Buruguduystunstugudunstuy
1 year, 3 months ago
The other options do not accurately specify the path to the subdirectory: Option A: The rmdir '~/\dir' command will not correctly interpret the '~' symbol and will try to remove a directory named '~/\dir'. Option B: The 'rmdir "~/\dir"' command will not correctly interpret the '~' symbol and will try to remove a directory named '~/\dir'. Option C: The 'rmdir ~/'dir' command will not interpret the backslash character as an escape character and will try to remove a directory named '~/dir'. Option E: The 'rmdir ~/\\dir' command will interpret the backslash characters as escape characters and will try to remove a directory named '~/dir'. Note: If the subdirectory is not empty, the 'rmdir' command will fail and you will need to use a different command, such as 'rm -r', to remove the directory.
upvoted 1 times
...
...
siddy_888
1 year, 4 months ago
Option E is correct.Option D won't work Below command will work. rmdir ~/'\dir' and rmdir ~/\\dir You can do it either way.
upvoted 2 times
...
MoOshin
1 year, 7 months ago
E is correct, you have to actually confirm the "\dir" directory was created. create the directory using, mkdir "\dir". You would find that only option can delete the directory.
upvoted 2 times
MoOshin
1 year, 7 months ago
You would find that only option E can delete the directory.
upvoted 2 times
...
...
CuriousLinuxCat
2 years, 9 months ago
Can confirm D is correct. Tested on Ubuntu build.
upvoted 2 times
...
CuriousLinuxCat
2 years, 9 months ago
Can confirm D is correct. Tested on Ubuntu build.
upvoted 1 times
...
rhylos
2 years, 9 months ago
wrong. Correct answer is D . E does not work [student@centos ~]$ rmdir ~/\\dir rmdir: failed to remove ‘/home/student/\\dir’: No such file or directory [student@centos ~]$ rmdir ~/\dir
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...