Need to tidy up your Linux file system? Deleting directories is a fundamental skill. But tread carefully – deleting a directory removes everything inside, so double-check before you proceed! The primary command for deleting empty directories is `rmdir`. Simply type `rmdir directory_name` in your terminal. If the directory isn't empty, `rmdir` will throw an error.
For non-empty directories, you'll need the powerful `rm` command with the `-r` (recursive) flag. Use `rm -r directory_name`. This recursively deletes the directory and all its contents. **Warning:** This is permanent! Consider using the `-i` (interactive) flag, like this: `rm -ri directory_name`, which will prompt you to confirm each deletion. This provides an extra layer of safety. Choose the method that suits your needs and always double-check the directory name before pressing enter to avoid accidental data loss. Happy cleaning!