However, you may want that extra layer of protection.

you’ve got the option to easily turn on the confirmation for deleting files.

To begin, press Ctrl + Alt + T to open a Terminal window.

Enable the Confirmation when Deleting Files and Folders Using the rm Command in Ubuntu

Then, key in the following command at the prompt and press Enter.

gedit ~/.bashrc

This opens the bashrc file in the text editor gedit.

Enter the following line in the Alias definitions section:

alias rm=rm I

Click Save to save the file.

01_opening_bashrc

poke the X in the upper-right corner of the gedit window to close it.

The same file must be changed for the root user.

To do this, enter the following line at the prompt.

02_entering_alias_and_saving

sudo gedit /root/.bashrc

throw in the password when prompted and press Enter.

If you forget to precede the gedit command above with sudo, youll see the following message in gedit.

Close gedit and enter the above command again starting with sudo.

03_closing_gedit

Press y to delete the file, or n to keep it.

When you enter rm r to delete a folder, you will also get the confirmation.

This simple safeguard can secure your system if you accidentally delete an important file or folder.

04_opening_root_bashrc_file

05_could_not_open_root_bashrc

06_rm_confirmation