To remove a file in Linux, you can use the rm
command followed by a space and the name of the file in the Linux terminal.
For example, let's say you have a file called myFile.txt
and wants to delete it. You can use the rm
command like this in the terminal,
# Delete a file in Linux
rm myFile.txt
Executing the above command will delete the myFile.txt
file from the directory.
See the execution of the above command live in repl.it.
To delete more than 1 file at once, you can pass the name of the files with space in between them like this,
# Delete more than 1 file in Linux
rm myFile.txt myFile2.txt myFile3.txt
That's it 😃!