How to delete file on Linux

Configurare noua (How To)

Situatie

Deleting a file involves removing the reference to the file from the file system. The file itself is not immediately removed from the storage device, but its space is marked as available for reuse.

Using the GUI file manager

Most Linux distributions come with a GUI file manager that allows you to delete files using a graphical interface. Simply navigate to the file you want to delete, right-click it, and select “Delete” or “Move to Trash.”

Using the rm command

You can also use the rm (remove) command to delete files and directories in Linux. To delete a file using the rm command, type the following command in the terminal:

rm filename

Make sure you replace filename with the name of the file you want to delete. If the file is write-protected or you don’t have sufficient permissions to delete it, you will be prompted to confirm the deletion.

Using the shred command

The shred command is a more secure way to delete files by overwriting the file’s contents multiple times before deleting it. This makes it difficult for anyone to recover the deleted file.

To use the shred command, type the following command in the terminal:

shred -u filename

Make sure to replace filename with the name of the file you want to delete. The -u option tells shred to delete the file after overwriting it.

Using the trash-cli command

The trash-cli command provides a safer way to delete files by moving them to the trash instead of immediately deleting them. To be able to use the trash-cli command, you install it first:

sudo apt-get install trash-cli

After installation, you can delete a file using the following command:

trash filename

Solutie

Tip solutie

Permanent

Voteaza

(4 din 6 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?