How to Remove Files Using Linux Commands
Linux

How to Remove Files Using Linux Commands

Remove Files Using Linux Commands

If you are new to Linux, you must know Linux commands. We can do everything in Linux using the command line including the deletion of files or folders. In this tutorial, I will show you to remove files in Linux using the command line.

How to Remove Files

In Linux, we use either the rm or unlink command.

Here is the syntax

$ unlink filename
$ rm filename

While using these commands, be careful. It is because it will not ask for your confirmation when deleting files. Files once deleted using rm command are gone. So, be careful.

If you try to remove a file that is write-protected, it will ask you to confirm. In such cases, type Y and hit Enter to confirm the deletion. Otherwise, it will delete the file with our prompting.

If you are using the unlink command you can only remove one file at a time, but the rm command lets you remove multiple files at the same time.

To delete multiple files using the rm command, here is the syntax you need to follow.

$ rm filename1 filename2 filename3

The rm command also supports wildcard (*) and regular expansions. So, you can use these to delete multiple files. For example, if you want to remove all .jpg images in the current directory, use the following command.

$ rm *.jpg

If you want the system to confirm each file before deleting it, use -i option

$ rm -i filename(s)

If you do not want the prompt and force delete all files including write-protected. Use -f option to the rm command.

$ rm -f filename(s)

If you want to see the report of each file removed, use -v option.

$ rm -v filename(s)

You can also combine these options. Like if you want the system to prompt before each deletion and show the details. Combine -i and -v options. 

$ rm -iv filename(s)

Wrap Up

Now you know how to use rm command to delete files one by one or in bulk. I have also listed options you can use with rm commands. So, you can now start using the rm command.

administrator
Deepanker Verma is the founder of Nerdy Guides. He is a tech blogger, software developer, and gadget freak. He also runs TheWPGuides and Techlomedia.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    sugar rush oynasweet bonanza oynaCasinoslotBahisnowAviator oynaCasinoslotDemo slot oynaFlorya Elit escortçıtır escort yeşilköyescortYeşilköy elit escortYeşilköy otele gelen escortbayan escort merterfethiye escortısparta escortEscort Bayanbeylikdüzü escortbuca escortTürkiye Escort, Escort Bayanmarmaris escortgüneşli escortBahçeşehir escortsugar rush oynasweet bonanza oynaCasinoslotBahisnowAviator oynaCasinoslotDemo slot oynaFlorya Elit escortçıtır escort yeşilköyescortYeşilköy elit escortYeşilköy otele gelen escortbayan escort merterfethiye escortısparta escortEscort Bayanbeylikdüzü escortbuca escortTürkiye Escort, Escort Bayanmarmaris escortgüneşli escortBahçeşehir escortSütunlar güncellendi.
    pendik evden eve nakliyatkeçiören evden eve nakliyatankara evden eve nakliyattuzla evden eve nakliyateskişehir protez saçİstanbul Bodrum nakliyeİstanbul İzmir eşya taşımaankara gülüş tasarımıKartal evden eve nakliyattuzla evden eve nakliyatistanbul evden eve nakliyatİstanbul Bodrum nakliyeİstanbul İzmir eşya taşımaeskişehir uydu tamireskişehir uydu tamirEskişehir uyduankara evden eve nakliyatkadıköy evden eve nakliyatDeselerMasal OkuMasallar Okuantalya haberpendik evden eve nakliyatkeçiören evden eve nakliyatankara evden eve nakliyattuzla evden eve nakliyateskişehir protez saçİstanbul Bodrum nakliyeİstanbul İzmir eşya taşımaankara gülüş tasarımıKartal evden eve nakliyattuzla evden eve nakliyatistanbul evden eve nakliyatİstanbul Bodrum nakliyeİstanbul İzmir eşya taşımaeskişehir uydu tamireskişehir uydu tamirEskişehir uyduankara evden eve nakliyatkadıköy evden eve nakliyatDeselerMasal OkuMasallar Okuantalya haberSütunlar güncellendi.