Skip to content

How to delete Files in Linux?

  • by
  • 2 min read

Linux is known for its powerful terminal commands that can take care of anything you need to do on your system without ever having to touch the mouse.

Every Linux beginner is urged to command a certain level of mastery over the terminal. It’s ultimately more convenient than moving around the mouse a bunch. If you know what you’re doing, using the terminal is always faster and hassle-free.

In this article, we’re going over the rm and unlink commands to give you an idea of how to remove files in Linux.

Also read: How to run Linux on top of Windows using VirtualBox?


How to remove files in Linux using the command terminal?

Deleting files from Linux is rather easy. You have to type in either the rm or the unlink command followed by the filename and hit enter.

The difference between the two is that while unlink allows you to remove a single file, rm can remove multiple files at once. Be sure to be very careful while using these commands. Deleting files is permanent, and you won’t be able to recover your lives (easily anyway) later. 

To remove a single file using rm or unlink, use the following commands.

unlink filename
rm filename

If you’re asked for a confirmation, press followed by enter. If you’re not asked for one, the mentioned file will be removed without any warnings. 

To delete multiple files at once, use the rm command.

rm file1 file2 file3

You can also use the * wildcard operator to delete matching files. For example, the following command will remove all .jpg files from the directory. 

rm *.jpg

If you combine the rm command with the –flag, the terminal will ask you before deleting each file specified. Similarly, if you’re using the command with the -f flag, all mentioned files, including write-protected ones, will be deleted without warning. 

Also read: How to install Steam on Linux?


How to removing files using the Linux interface?

This works pretty much exactly as you would expect. Access the file or folder, right-click it and click Delete. 

How to delete Files in Linux? | Candid.Technology

Like Window’s Recycle Bin, deleted files in Linux first go to the Trash from where they can be restored or permanently deleted.

Also read: How to install Kali Linux on Virtualbox?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>