[CentOS] Sorting of passwd/group files

Troy Engel tengel at fluid.com
Fri Mar 31 17:11:05 UTC 2006

Tony Schreiner wrote:
> sort -t: +0 /etc/passwd >outfile-byname
> sort -t: -n +2 /etc/passwd >outfile-byuid

I concur Kai, I use this method as well. Sometimes doing it by hand is a 
lot faster than a silly GUI app. :)

> for what purpose do you need this?

I can't speak for Kai, but here I have ranges of UIDs that are not very 
manageable via GUI tools (ie 1000 -> 1999 for employees, 2000 -> 2999 
for permanent contractors, 3000 -> 3999 for temporary contractors, 
ranges for services, CVS-only users, and so on and so forth).

Sorting by UID then makes it easy to glance and find the next UID in 
line to feed to useradd and LDAP.


Troy Engel | Systems Engineer
Fluid Inc. | http://www.fluid.com

More information about the CentOS mailing list