Delete Files and Documents in Linux  Step by Step Guide ▷ 2021

Deleting a document from Linux is not complicated, but you must do it very carefully especially if you are a beginner, as essential files could be deleted from the system and create breakdowns in the distribution you are using.

There are two ways to delete files in Linux. On the one hand there are those that are not permanently eliminated, they disappear from the user’s view and are saved somewhere else and, secondly, those that are permanently erased using some specific tools.

Although the way to delete Linux documents may change a bit depending on the storage system, this time we want to share the steps to delete any file from your computer with free software installed and we will also tell you the reasons to remove from your computer the things that you no longer need and that only take up valuable space.

Learn step by step how to delete any file or document on your computer with Linux operating system

In order not to accidentally delete important files from your computer, it is key for the administrator to learn to use the commands, as well as knowing the functions and tasks that are carried out with each of them.

Now, we are going to show you how to delete a single file, several at the same time or an entire folder:

Delete a file

File manager interface on Linux

For delete a single file that we no longer need on the computer, we will use the command “rm” (remove in English). However, we warn you that you must be sure that you want to delete the document since it does not ask for any confirmation before executing the order.

To do the homework, follow these steps:

  • Open the linux terminal.
  • Type this command: rm eliminame.odt, the last word is the name of the file with its extension to be removed.

Delete multiple files at once

To delete several elements at the same time, you must make a list with the names of each of the files and you are going to write them with a space in between as follows:

  • Run the console command of Linux.
  • Place this command for each file to delete: rm eliminame.odt
  • As you add, it should look like this with the respective space between one and the other: rm eliminame.odt eliminame2.odt.

Delete a folder

Folder appearance in Linux

If you want to delete a complete folder with all the documents it has inside, because none of you need them anymore, you are going to carry out the following steps:

  • Open terminal Linux.
  • Use this command: rm -r Archivos/*This will delete all the documents inside, but not the directory.
  • In this case, place –r makes it possible for resources located within the folder to be removed.
  • To delete only one type of files that are in the folder, you can use an asterisk followed by the extension. An example would be like this: rm *.doc.
  • And if you want to force the deletion of the files, regardless of any factor, use this command: rm -rf Dir1.

To complement the use of the “rm” command, we want to leave you some options that you can apply when deleting files:

  • i: ask if you are sure to delete.
  • preserve-root: it keeps its default settings regarding the root file.
  • d: remove empty directories.
  • help: A help message appears.

Apart from the commands, you have the possibility of delete the files through the native manager of your distro.

The way to do it is as follows:

  • Open the manager and access the files you want to delete.
  • Hold down the left button mouse and go selecting the files you want to delete.
  • Once selected, use the right mouse button and there you will see the options to remove.
  • select one of the options, What are they: “Remove“,”Send to trash“Or”Delete files”And the erasure is ready.

Why is it important to delete unnecessary or unused files in Linux? Reasons to do it

Folders in Linux can have different icons

Sometimes, we do not care much about maintaining or cleaning the computer and this fills up with unnecessary applications or files that we never stop to look at, because we just don’t need them.

However, this aspect also needs to be given attention and here are several reasons to do so:

  • The computer works better and it works faster, especially if the files were very heavy.
  • Space is freed of the hard disk that you can use to store things that you really need.
  • We prevent errors from occurring in the operating system.
  • We increase file security preventing the system from collapsing.
  • By having more space available, the hardware installed in the computer will work with less effort, which will extend its useful life.

Finally, we indicate that it is recommended to frequently clean the temporary files folder In which you can save remnants of installed packages, dependencies, duplicate files or internet browsing history. Doing this will allow you to have a quick response computer.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will surely be of great help to more members of the community. Thanks! 😉

Author: Mario José

Graduated in journalism, specialized in investigation, I seek the truth of all things. Now 100% focused on technology, computing and Internet issues.

You may be interested:

Rate this post

Leave a Comment