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.
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 y 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.
If you combine the rm command with the –i 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.
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?
Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars. You can reach out to Yadullah at [email protected], or follow him on Instagram or Twitter.