Operating System - Linux
1830233 Members
2303 Online
109999 Solutions
New Discussion

Script to find all numeric uid files

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Script to find all numeric uid files

Hi,

We did a server migration on the weekend and there are some files scattered throughout the system that have a numeric UID rather than the name. Does anyone know of a quick script to find the files and print them to the screen?

Thanks
7 REPLIES 7
Jeff_Traigle
Honored Contributor
Solution

Re: Script to find all numeric uid files

find / -nouser
--
Jeff Traigle
Coolmar
Esteemed Contributor

Re: Script to find all numeric uid files

Thanks!
James R. Ferguson
Acclaimed Contributor

Re: Script to find all numeric uid files

Hi:

I like to do consider both uids and gids that are unmapped:

# find / \( -nogroup -o -nouser \) -exec ls -ld {} \+

This is a brutal search of all filesystems. The "+" terminator bundles multiple arguments to pass them as a larger list to 'ls'.

Regards!

...JRF...
Coolmar
Esteemed Contributor

Re: Script to find all numeric uid files

thanks James....it didn't like the "-o" but without it says "find:missing conjuction"
James R. Ferguson
Acclaimed Contributor

Re: Script to find all numeric uid files

Hi (again):

> it didn't like the "-o" but without it says "find:missing conjuction"

That's odd, I can cut-and-(re)paste and don't have any problems.

Regards!

...JRF...
Coolmar
Esteemed Contributor

Re: Script to find all numeric uid files

Yep, I typed it and I guess there was a problem with a space or something. When I cut and pasted it was fine. Thanks James.
James R. Ferguson
Acclaimed Contributor

Re: Script to find all numeric uid files

Hi:

Please note that it is possible to reopen a closed thread to assign points if you see fit:

http://forums1.itrc.hp.com/service/forums/helptips.do?#41

Regards!

...JRF...