# How do I delete a directory in Centos 7 [duplicate]

John yesterday at 15:03. 3 answers, 0 views

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?

micah94 11/21/2017.

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

Or you can force it with rm -r john.

Slavik Svyrydiuk 11/21/2017.

You can use

rm -f -r john

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

0x40 11/21/2017.
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.