How to delete a non-empty directory in Terminal?

Issues related to applications and software problems and general support
Post Reply
shrisahu
Posts: 1
Joined: 2021/04/26 09:26:22

How to delete a non-empty directory in Terminal?

Post by shrisahu » 2021/04/26 09:30:48

I am new to Linux.

How do I delete a directory with its contents forcefully?

I typed:

Code: Select all

# rmdir lampp
This error comes up:

Code: Select all

rmdir: failed to remove `lampp': Directory not empty
Is there a command to delete all the files in the directory and delete the directory folder?

Thanks
Last edited by shrisahu on 2021/04/29 06:20:02, edited 2 times in total.

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: How to delete a non-empty directory in Terminal?

Post by scottro » 2021/04/26 10:46:56

If a directory isn't empty, you can either change into the directory and remove everything in it, or use rm -fr <directory-name>. Be sure there is nothing in there that you need.
New users should check the FAQ and Read Me First pages

Post Reply