Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
16
rated 0 times [  16] [ 0]  / answers: 1 / hits: 9975  / 1 Year ago, sat, february 11, 2023, 10:58:26

Is this safe to use?



sudo rm /Desktop/FILENAME


The reason for wanting to use sudo is I can't see the file.



I accidentally typed in sudo rm /Desktop/index.html. It didn't find it but could something still have been deleted?


More From » sudo

 Answers
7

The slash at the start of /Desktop would have caused it to look for a Desktop folder in the root of the filesystem, which almost certainly does not exist, therefore nothing would have been deleted.



In future, keep in mind that both sudo and rm have the ability to be dangerous. You should never need sudo just to manipulate your own files, and if you do need sudo to delete a file, it's generally a file you shouldn't be deleting unless you know what you're doing (there are exceptions, for example it's safe to modify/delete whatever you want in /var/www or /srv, etc if you run a server, or /usr/local if you compile and install your own software, but that's more advanced than general use).



As for rm, well it doesn't move things into a "Trash" bin for you, so in that sense it's not all that safe, in that it's easy to irrecoverably lose something.



It sounds most likely you were looking in the wrong place, right? index.html isn't a hidden file (hidden files begin with a dot) so you should be able to see it in your file browser.


[#23987] Sunday, February 12, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ardtry

Total Points: 254
Total Questions: 99
Total Answers: 114

Location: Finland
Member since Fri, Oct 21, 2022
2 Years ago
ardtry questions
;