Monday, January 6, 2025
HomeTechHow to Remove a Directory in Linux

How to Remove a Directory in Linux

  1. Remove an Empty Directory:
    bash
    rmdir directory_name
  2. Remove a Non-Empty Directory:
    bash
    rm -r directory_name
  3. Force Remove a Directory:
    bash
    rm -rf directory_name
    • Use with caution, as it deletes without confirmation.
  4. Remove Multiple Directories:
    bash
    rm -r dir1 dir2

Notes:

  • Ensure you have the necessary permissions.
  • Double-check the directory to avoid accidental data loss
RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x