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
9 Comments on “Which of the following commands will remove that directory?”
Starrsays:
E is not the correct answer. The answer should be B
0
1
grasays:
I think it should be B
0
0
director47says:
It is E.
B would remove a directory of the name \dir since the first \ is to escape the following \
Test it by creating the directory \\dir. In order to create that directory, you would need to type mkdir ~/\\\\dir. The first \ would escape the second \ and the 3rd \ would escape the 4th \ thus creating \\dir
So in order to remove it you would do the same.
rmdir ~/\\\\dir where the first \ would escape the second \ and the 3rd \ would escape the 4th \
1
0
gregsays:
No, the correct answer is E, as the backslask “\” escapes itself. You need 4 \ to get the path \\dir
0
0
Anonsays:
You’d know the correct answer if you actually tried the command and learned
0
0
Teerawatsays:
The correct one is B, I just try after read the comment.
0
0
Davisays:
I have now tested on my Linux Ubuntu and only option E is correct:
rmdir ~/\\\\dir
I tested the other options and they all went wrong
0
0
Mahonisays:
Thank you so much, Guys
0
0
manni9says:
Answer E is correct!
To create a directory named \\dir the command mkdir \\\\dir is required.
With the command rmdir \\\\dir the directory is deleted.
If a \ is used in the name of a directory, every \ with a preceding \ must be used.
E is not the correct answer. The answer should be B
0
1
I think it should be B
0
0
It is E.
B would remove a directory of the name \dir since the first \ is to escape the following \
Test it by creating the directory \\dir. In order to create that directory, you would need to type mkdir ~/\\\\dir. The first \ would escape the second \ and the 3rd \ would escape the 4th \ thus creating \\dir
So in order to remove it you would do the same.
rmdir ~/\\\\dir where the first \ would escape the second \ and the 3rd \ would escape the 4th \
1
0
No, the correct answer is E, as the backslask “\” escapes itself. You need 4 \ to get the path \\dir
0
0
You’d know the correct answer if you actually tried the command and learned
0
0
The correct one is B, I just try after read the comment.
0
0
I have now tested on my Linux Ubuntu and only option E is correct:
rmdir ~/\\\\dir
I tested the other options and they all went wrong
0
0
Thank you so much, Guys
0
0
Answer E is correct!
To create a directory named \\dir the command mkdir \\\\dir is required.
With the command rmdir \\\\dir the directory is deleted.
If a \ is used in the name of a directory, every \ with a preceding \ must be used.
0
0