-2

This question already has an answer here:

I am using Centos as my server OS and in my desktop I have a directory called "john", I need delete it via a command. How can I do this?

marked as duplicate by Hunter.S.Thompson, Archemar, Christopher, Stephen Rauch, Jeff Schaller Nov 21 '17 at 15:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

You can use

rm -f -r john

It will recursively delete john directory even if it contains files or subdirectories.

  • 3
    You can have -f and -r together. Like this : rm -rf. – Hunter.S.Thompson Nov 21 '17 at 15:27
1

If the directory is empty then you can just do rmdir john.

Or you can force it with rm -r john.

0
rm -r ${XDG_DESKTOP_DIR:-$HOME/Desktop}/john

XDG_DESKTOP_DIR is an environment variable that contains the path to the desktop directory. If it's not set, we fall back to $HOME/Desktop.

  • my account is [root@localhost]# if it is so how can I remove My desktop directory. I am little bit confused with this ${XDG_DESKTOP_DIR:- – John Nov 21 '17 at 15:28
  • @John why on earth are you logging in as root for normal operations? – roaima Nov 21 '17 at 15:54
  • ok tell me delete desktop directory logging as normal user – John Nov 21 '17 at 16:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.