Mar 12, 2019
378 Views
Comments Off on How to delete a directory in Linux command line

How to delete a directory in Linux command line

Written by

When attempting to remove a directory in the command line on a Linux box you may receive an error “directory not empty” when trying to run

rmdir  thedirectorytodelete

The solution to this is to run

rm -rf thedirectorytodelete

This will force the directory and all the contents there in to be erased.

You will be asked if you wish to proceed

 

If you want to be asked for each file, then you would do

rm -r thedirectorytodelete

 

remember always to use caution when using  rm -rf as

rm -rf /

Would be disastrous.

Leave your vote

0 points
Upvote Downvote

Comments

0 comments

Article Tags:
·
Article Categories:
Linux

Log In

Forgot password?

Forgot password?

Enter your account data and we will send you a link to reset your password.

Your password reset link appears to be invalid or expired.

Log in

Privacy Policy

Add to Collection

No Collections

Here you'll find all collections you've created before.