To delete and remove files on CentOS Linux, you can use the rm
command in the terminal. The rm
command is used to remove files and directories.
Here are some common usage examples of the rm
command:
- To remove a single file, use the following command:
rm file_name
- To remove multiple files, specify the file names separated by space:
rm file_name1 file_name2 file_name3
- To remove a directory, use the
-r
option to recursively remove the directory and its contents:
rm -r directory_name
- To remove a symbolic link, use the
-f
option to force remove the symbolic link without confirming:
rm -f symbolic_link_name
Note: Be careful when using the rm
command, as it permanently deletes files and directories, and there is no way to recover them once they are removed.