Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Subscribe to RSS feed


Find and remove Mac OS X dotfiles

Stanislav KhromovStanislav Khromov

There are two types of hidden “dotfiles” that OS X clutters USB drives with:

.DS_Store and ._filename (for example ._catfish.jpg)

To find all these files in a folder (In example: /home/yourfolder ), run this:

find /home/folder -name ._* -o -name .DS_Store

To delete them instead of just displaying them, use this command:

find /home/folder -name "._*" -o -name ".DS_Store" | sed 's/.*/"&"/' | xargs rm

Note: The sed command is used to enclose all input sent to rm with quotes, so it works with files containing spaces.

Full-stack impostor syndrome sufferer & Software Engineer at Schibsted Media Group

Comments 0
There are currently no comments.