People pointing answers C and D are not creating the directory with the leading \. To do that you need do use mkdir "\dir" since mkdir \dir will create a directory named only "dir". Thats why C and D are working for them.
Correct answer is A.
The correct answer is D:
[worker1@server ~]$ mkdir \dir
[worker1@server ~]$ cd ..
[dawoud@server home]$ rmdir ~/\\dir
rmdir: konnte '/home/worker1/\dir' nicht entfernen: Datei oder Verzeichnis nicht gefunden
I think rhat C and D...
on this cases... works the remove directory
$ mkdir dir
$ ls dir
$ ls d*
dexample.gz.tar
dir:
rmdir ~/\dir
$ ls d*
dexample.gz.tar
$ mkdir dir
sblanco@idp:~$ rmdir ~/'dir'
sblanco@idp:~$ ls d*
dexample.gz.tar
$ mkdir dir
$ rmdir ~/'dir'
$ ls d*
dexample.gz.tar
A: seen as correct in another guide and tested in my home directory as regular user, cemtos 7, not root:
mkdir "\dir"
ls -l
\dir
then tried the different deleting options and the only working was A, no need to use any quotation marks.
basically, you can create \dir directory in homedir using 'mkdir ~/\\dir'
That's why answer is A that using the same way to remove it.
Note: backslash "\" used to remove special meaning on the following character, Example:
\x will display x as string even though x has a special meaning.
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.
Murteira
Highly Voted 3 years, 4 months agoiwkno6
3 years, 2 months agoCuriousLinuxCat
3 years, 2 months agopablex_wolf
Highly Voted 4 years, 4 months agob703161
Most Recent 3 weeks agoAleksandre
2 months, 2 weeks agopeppiniello
11 months, 1 week agosblancocr
1 year agoJack67
1 year, 5 months agoTT924
1 year, 10 months agoblk_542
1 year, 10 months agomeer01
1 year, 11 months agogonzaloco
2 years, 5 months agoKiddyLitty
2 years, 6 months agoKiddyLitty
2 years, 6 months agoLazylinux
2 years, 6 months agonedoex
2 years, 8 months agoserlan
2 years, 9 months agoanhcq
2 years, 10 months agoRoger95
2 years, 10 months ago