How To Install safe-rm on Debian 9

In this tutorial we learn how to install safe-rm on Debian 9. safe-rm is wrapper around the rm command to prevent accidental deletions

Introduction

In this tutorial we learn how to install safe-rm on Debian 9.

What is safe-rm

safe-rm is:

This package provides a tool intended to prevent the accidental deletion of important files by replacing rm with a wrapper, which checks the given arguments against a configurable blacklist of files and directories that should never be removed.

Users who attempt to delete one of these protected files or directories will not be able to do so and will be shown a warning message instead.

Protected paths can be set both at the site and user levels.

There are three methods to install safe-rm on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install safe-rm Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install safe-rm using apt-get by running the following command:

sudo apt-get -y install safe-rm

Install safe-rm Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install safe-rm using apt by running the following command:

sudo apt -y install safe-rm

Install safe-rm Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install safe-rm using aptitude by running the following command:

sudo aptitude -y install safe-rm

How To Uninstall safe-rm on Debian 9

To uninstall only the safe-rm package we can use the following command:

sudo apt-get remove safe-rm

Uninstall safe-rm And Its Dependencies

To uninstall safe-rm and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove safe-rm

Remove safe-rm Configurations and Data

To remove safe-rm configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge safe-rm

Remove safe-rm configuration, data, and all of its dependencies

We can use the following command to remove safe-rm configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge safe-rm

Dependencies

safe-rm have the following dependencies:

References

Summary

In this tutorial we learn how to install safe-rm package on Debian 9 using different package management tools: apt, apt-get and aptitude.