- 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
- You must be logged in to reply to this topic.