🐧 Linux / Shell Scripting
Beginner
How do you remove a file in Linux?
Answer
Use the rm command. rm filename deletes a file. rm -f filename forces deletion without prompting. rm -r dirname recursively deletes a directory and all its contents. rm -rf dirname is a common but dangerous combination — it force-deletes recursively with no confirmation. To remove an empty directory, use rmdir dirname. Always double-check paths before using rm -rf as there is no recycle bin — deleted files are gone immediately.