Let's understand how rm -rf
command works first. It removes everything in a given directory and the directory itself, so if you give it path $HOME/directory_1/directory_2/
the directory_2
will be gone along with its files. The rest of the path will be safe. Heres' an example:
$ tree somethings/
somethings/
└── subdirectory_1
├── a
└── b
1 directory, 2 files
$ rm -rf somethings/subdirectory_1/
$ tree somethings
somethings
So as far as your commands go:
rm -r "$HOME/.wine"
only removed .wine
directory
rm $HOME/.config/menus/applications-merged/wine*
only took care of all files starting with wine
string in $HOME/.config/menus/applications-merged
folder
rm -r "$HOME/.local/share/applications/wine"
removed the wine
folder only
rm $HOME/.local/share/desktop-directories/wine*
got rid of the files starting with wine
in $HOME/.local/share/desktop-directories
folder
rm $HOME/.local/share/icons/????_*.xpm
nuked all .xpm
files.
In other words they're sufficiently safe.
What me and Rinzwind have discussed in the comments and Ask Ubuntu chatroom, is that it's possible to alter $HOME
variable. Yes, it is possible, but if you intentionally alter $HOME
, you need to keep that in mind; otherwise, it's not rm
's fault and let's be honest - it's plain stupid from user's point of view. Commands work only on the path you give it, so give the commands proper path.
Other potential issues is spaces. If you have space in your home folder name, like /home/My User
, then without quotes around $HOME
the shell will think you're giving it two arguments, /home/My
and User
. This effect is known as word splitting. So always quote your variables like "$HOME"
rm -rf "$HOME"
. So I suggest you to first read the whole article before attempting to run something which includesrm
in the command. – Geppettvs D'Constanzo May 05 '17 at 20:44