How to move files to the trash from the command line

I’m not fan of the command line. But it’s necessary if you want to get things done. Any linux / mac command line user should know how to use the rm command. But what if you want the files to go to the trash can instead? Here’s how to do that on mac.

First, get yourself brew

Then all you have to do is this:

From then on, all you have to do is type:

Your file will then be moved into the trash can. What if you want to use rm to do that? Just don’t think that way. There’s a way to do it, but what happens when you’re so comfortable using rm to move things to the trash, and you’re on a system that doesn’t have rm setup to move files to the trash can? You’re gonna hate life, and I don’t want that to happen to you.

I’m a fan of Ubuntu, so here’s how to move files to the trash can on Ubuntu:

View files in trash:

Finally, here’s how to empty the trash:

There you go.


You’ve learned how to move files to the trash can on Mac & Ubuntu (Linux). Now you get a second chance with the files you delete. Remember, with great power, comes great responsibility. Use with care.

Leave a comment

Find the Best SEO in Fort Lauderdale, Florida (Plantation SEO) | Drupal & Worpress Develpment