Linux / UNIX delete a file using rm command

Linux / UNIX delete a file using rm command

To delete a file using the rm command in Linux or Unix, use the following syntax:

rm filename
S‮o‬urce:www.lautturi.com

Replace filename with the name of the file you want to delete.

For example, to delete a file named file.txt, you would run the following command:

rm file.txt

By default, rm does not prompt for confirmation before deleting a file. If you want to be prompted before each file is deleted, you can use the -i option:

rm -i file.txt

If you want to delete multiple files at once, you can specify them all on the command line:

rm file1.txt file2.txt file3.txt

Note: Be careful when using rm, as it permanently removes files and does not have an undelete feature. If you accidentally delete a file that you need, you may not be able to recover it.

Created Time:2017-10-29 22:08:55  Author:lautturi