How to delete a directory in the Linux terminal?
Tagged: linux
- AuthorPosts
- August 28, 2020 at 12:31 PM #3690
Santhosh Kumar D
Keymaster@santhoshLearning how to delete a directory in the Linux terminal makes it easy to manage directories.
To delete an empty directory, you need to use the
rm -d
command followed by the name of the directory that you want to delete.rm -d directory
To delete a directory containing subdirectories and files, use the
rm -r
command followed by the name of the directory you want to delete.rm -r directory
And to delete multiple directories containing subdirectories and files, use the
rm -r
command followed by directory names separated by a space.rm -r directory1 directory2 directory3
Note: Please be careful when deleting files or directories, because once deleted, it is not easy to recover them.
Learn more Linux commands.
August 28, 2020 at 1:03 PM #3696Santhosh Kumar D
Keymaster@santhoshIf a subdirectory or a file within the main directory is write-protected, you will be prompted to confirm the deletion.
To force delete a directory containing subdirectories and files without being prompted, you need to use the
rm -rf
command followed by the directory name.rm -rf directory
- AuthorPosts
Advertisement
RECENT TIPS
- How to send email as an alias in Gmail?
- How to stop Google from tracking your location?
- Command to check the Ubuntu version
- How to add a percentage in Excel?
- How to convert currencies in Google Sheets?
- How to voice type on Google Docs?
- What is Django framework?
- How to turn Google Assistant off?
- How to check the Python version?
- How to create a virtual environment in Python?
- How to change the directory in the Command Prompt?
- How to add a shortcode in WordPress PHP template file?
- Useful websites to research stocks
- How to check Linux uptime?
- How to check Linux last reboot time?