Linux command to delete a file
January 28, 2019
Here's how to delete a file from the command line on a Linux machine.
rm filename
- Where 'filename' is the name of the file
The rm command can be used with some options
rm -r or rm -R
Using the rm command with -r or -R added to it allows you to remove a directory and all of its contents. For instance if I have a directory named oldstuff which contains any number of files and directories, I can delete the oldstuff directory and all of the files and folders inside of it with the following command:
rm -r oldstuff
That's all you need to do if you want to delete files or directories on a Linux machine from the command line.