Linux: delete file - how to get rid of the contents
Linux refers to all operating systems based on the Linux kernel and essentially the GNU software. Regardless of which distribution you have chosen, a similar range of functions is available to you. If you want to delete a file, then this is possible in a few steps.
How to delete a file in Linux
If you want to delete a file in a Linux distribution, you have different options, as with other operating systems. So you have the choice between using the command line or deleting via the file manager.- To delete a file via the file manager, select all files you want to delete. This is only necessary if there are multiple files.
- Then right-click on the selected files to open a context menu.
- Select the option "Move to trash" here. In some distributions, the corresponding option is also called "Delete files" or "Remove". In addition, you can press the "Del" key.
- If, on the other hand, you want to delete the files using the console, you need the appropriate command.
- Open a new terminal window via the icon or the right mouse button. For some distributions, it is necessary to open the console in another way.
- Write the command "rm" and then the names of the files separated by a space. Confirm the input with the "Enter" key. If it is a folder, write "rm -r" and then the name of the folder.