How to delete a directory in the Linux terminal?
- August 28, 2020 at 12:31 PM #3690Santhosh Kumar DKeymaster@santhosh
Learning 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 -dcommand 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 -rcommand 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 -rcommand 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 DKeymaster@santhosh
If 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 -rfcommand followed by the directory name.
rm -rf directory
- 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?
- How to ZIP and UNZIP files in Linux?
- How to change the file owner and group in Linux?
- Protect your email address with Firefox Relay
- How to change the language in Microsoft Office?
- How to get Twitter dark mode on desktop and mobile?