A very capable young man installed Ubuntu on my Mac, but I don't know how he did it.
When I copy files to my MacBook Pro from another "ordinary" Ubuntu PC I find a lot of duplicate files with the prefix ._
(dot underscore).
On searching the Internet I find that all replies to this question are related to OSX.
Not being very techie, I would appreciate someone sending me a terminal command to wipe all files on my Ubuntu-Mac which have the prefix ._
... unless of course this will do something disastrous!
You can remove files with
rm
, but as you already guessed that command has its risks. To prevent disasters there's thesafe-rm
package, so I recommend to install this first with:It will automatically prevent you from removing anything important to the system.
Now to list every file beginning with
._
in the current directory do:To remove all files beginning with
._
in the current directory asking for every single one do:To remove all files beginning with
._
in the current directory without asking – Caution! – do:To do this recursively you can use the
extglob
functionality which needs to be enabled usingshopt -s extglob
(once per terminal window where you want to use it). After that you can doand it will remove every
._
file in the current directory as well as its subdirectories (and ask for every single one, you guessed it).The asterisk
*
is a special character to the shell and simply matches any string, so._*
matches any file beginning with._
. The globstar pattern**
followed by a/
matches directories and subdirectories and needs theextglob
option, which is not enabled by default.