PrepAway - Latest Free Exam Questions & Answers

Which of the following commands will remove that directory?

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

PrepAway - Latest Free Exam Questions & Answers

A.
rmdir ~/’dir’

B.
rmdir ~/\dir

C.
rmdir ‘~/\dir’

D.
rmdir “~/\dir”

E.
rmdir ~/\\dir

Explanation:

11 Comments on “Which of the following commands will remove that directory?

        1. director47 says:

          The answer is E. try to create a directory labeled “\dir”

          mkdir ~/\\dir would create that.

          mkdir ~/\dir would create dir

          test it by doing the following. Make sure you are in your home.

          cd ~
          mkdir ~/\\dir

          ls -l
          # the output will show \dir as the name of the directory.
          #now try removing it using the wrong answers and then the correct one. you will see that E is correct.

          rmdir ~/\\dir

          ls -l




          5



          0
      1. Ken Masters says:

        The answer is E. As explained the “\” is a special character and needs to be “escaped”. Do that by adding another “\” which is the escape character. This will negate the \ in the directory name.




        0



        0
  1. Syr says:

    zone@zone:~$ rmdir ~/\\dir
    rmdir: failed to remove ‘/home/uone/\dir’: No such file or directory

    and

    rmdir ~/\dir works and no error, anyone cares explain?




    0



    0

Leave a Reply