Re: changing user id for all files in a file system
#include <hallo.h>
* George Borisov [Thu, Jun 15 2006, 11:21:24AM]:
> Stephen R Laniel wrote:
> >
> > sudo find / -uid [old UID] |xargs -i sudo chown [new UID] '{}'
>
> Thanks for introducing me to the xargs command - never heard of it
> before, but I am sure it will come in handy some day. :-)
>
> The '-i' option is deprecated in xargs from unstable, though.
> Alternative seems to be:
>
> find / -uid OLDUID | xargs -I [] chown NEWUID []
>
> (I've removed the 'sudo' bits, as it would not work with the default
> setup.)
Why fiddling around with bracket monsters? GNU find and xargs have means
to protect commands from failing on spaces&co.
find / -uid OLDUID -print0 | xargs -0 chown NEWUID
Eduard.
Reply to: