How to delete a file in the Linux terminal?
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Tagged: linux
Learning how to delete a file in the Linux terminal makes it easy to manage files. To delete a file, you need to use the rm
command followed by the file name that you want to delete.
To delete a single file, use the rm
command followed by the file name.
rm filename
And to delete multiple files, use the rm
command followed by file names separated by a space.
rm filename1 filename2 filename3
Note: Please be careful when deleting files or directories, because once deleted, it is not easy to recover them.
Learn more Linux commands.
If a file is write-protected, you will be prompted to confirm the deletion. To force delete a file without being prompted, you need to use the rm -f
command followed by the file name.
rm -f filename