Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Linux deletes folder commands using methods


May 22, 2021 Linux



In Linux, the way to delete folders and files in a directory is actually simple, using the rm-rf command.


Linux deletes folder commands using methods Linux commands are complete


Specific usage rules:

rm -rf directory name

-r Recursive down, regardless of how many levels of directories are deleted.

-f Directly forcibly removed without any prompt.


Instance:


Delete folder instances:

rm -rf /var/log/httpd

This code means to delete the /var/log/httpd directory and all the files and folders between it


Delete a file instance:

rm -f /var/log/httpd/access.log

This will force the deletion /var/log/httpd/access .log this file


Attention:

There is no recycle bin set in l inux, so be careful when using the rm command, deleted files cannot be recovered.