To delete a folder and its contents on a Linux system, you can use the rm
command with the -r
flag. Here's how:
Open a terminal window.
Navigate to the directory containing the folder that you want to delete.
Type the following command to delete the folder and its contents:
rm -r foldername
Replace foldername
with the name of the folder that you want to delete.
Keep in mind that the rm
command is a powerful tool that can delete files and directories permanently. Be careful when using it, as there is no way to recover deleted files or directories.
If you want to delete the folder and its contents, but want to be prompted for confirmation before each file or directory is deleted, you can use the rm
command with the -i
flag. For example:
rm -ri foldername
This will prompt you for confirmation before deleting each file or directory. You can press y
to delete the item, or n
to skip it.
By following these steps, you should be able to delete a folder and its contents on a Linux system using the rm
command.