To delete files in Linux, use the rm
command:
- Basic Command:
rm filename
(Deletes a specific file). - Delete Multiple Files:
rm file1 file2 file3
. - Force Delete:
rm -f filename
(Skips confirmation). - Interactive Mode:
rm -i filename
(Asks before deleting). - Recursive Deletion:
rm -r directory
(Deletes directory and contents).
Be cautious when using rm
, especially with -f
or -r
, as deletions are permanent.