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, 6 months agoiwkno6
3 years, 4 months agoCuriousLinuxCat
3 years, 4 months agopablex_wolf
Highly Voted 4 years, 6 months agob703161
Most Recent 2 months, 2 weeks agoAleksandre
4 months, 2 weeks agopeppiniello
1 year, 1 month agosblancocr
1 year, 2 months agoJack67
1 year, 6 months agoTT924
2 years agoblk_542
2 years agomeer01
2 years, 1 month agogonzaloco
2 years, 7 months agoKiddyLitty
2 years, 7 months agoKiddyLitty
2 years, 7 months agoLazylinux
2 years, 8 months agonedoex
2 years, 10 months agoserlan
2 years, 11 months agoanhcq
3 years agoRoger95
3 years ago