If I put a file in the trash and "empty trash", is that the same as doing rm file?

I understand that there are questions here asking about (e.g. [1] [2] [3] [4] [5]), but no answer directly pertains to the difference in process (if there is one).


Yes, rm removes the file as does moving it to trash and then emptying the trash. One nice thing about moving files to Trash is that it gives you a little longer to decide if you really want to delete them. rm will remove immediately.

  • 7
    rm does not prompt by default (except in special cases, like files you don't have write permission to). If you want it to prompt, use rm -i. – Gordon Davisson Jun 14 '20 at 23:12
  • well it prompts me a lot if I don't use the -f option. maybe its what you said but if I use -f then i'm never bothered with the confirmation. I never use -i. – Natsfan Jun 15 '20 at 2:50
  • That's really strange. Do you have an alias for rm or something like that? If not, what's the exact prompt you get when deleting a normal file? – Gordon Davisson Jun 15 '20 at 3:06
  • rm doesn’t prompt by default (unless you don‘t have write access to the file you want to delete), that part of the answer is dangerously wrong. – nohillside Jun 16 '20 at 5:19

If I put a file in the trash and "empty trash", is that the same as doing rm file?

Effectively yes, although the details may vary under the hood. In both cases, the file can no longer be recovered except under certain circumstances1, 2, 3, 4, or perhaps using forensic data recovery techniques.

That said, I'd like to offer this as an adjunct:

I've always liked the concept of "moving to trash" because it gives you a second chance. When I started with Unix systems, I was always nervous about using rm... still am in fact.

And so I was very pleased when I found the trash utility for macOS by dabrahams. There was an extensive discussion here on moving files to the Trash folder from the command line, and IMHO, this one was the best.

Old habits die hard, and so I created an alias - if I enter rm, trash is called. If I'm feeling cocky, and really wish to rm - I have another alias for that.

  • Might be worth noting that rm is significantly faster, especially for directory structures, and that rm (maybe combined with sudo) can remove files which aren‘t removable with „Empty Trash“. – nohillside Jun 16 '20 at 7:56
  • That's worth knowing! – Seamus Jun 16 '20 at 8:16
  • @nohillside: Is there something obviously wrong with this answer that I've not seen? – Seamus Jun 21 '20 at 10:17
  • Some people may consider aliasing rm to be bad advice, some may think that the main part of the answer doesn‘t address the question, some may just have had a bad day, who knows... – nohillside Jun 21 '20 at 10:22
  • @nohillside: ok, thanks. I'll make a note to delete it in a few days. – Seamus Jun 21 '20 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .