How to access Trash Folder using Mac Terminal Command


We can access the Trash folder using the Terminal by making use of the cd command followed by ~/.Trash.

Example:
% cd ~/.Trash

% pwd 
/Users/c2ctech/.Trash

Now but when you try to do an ls command, you will get an error "ls: .: Operation not permitted"

Mac Terminal Move to Trash folder Example

This can still be handly to move files to Trash from Terminal instead of using the rm command which will delete the file(s) permanently.


Example:
mv oldfile.csv ~/.Trash

This is not an AI-generated article but is demonstrated by a human on an M1 Mac running macOS Sonoma 14.0.

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap