Finding UIDs

2026-01-15

Here’s a Perl one-liner to check for the next available UID on a Unix system:

perl -E '$i=1000; $i++ while getpwuid($i); say $i'

Sure, you can always parse /etc/passwd using utilities available in /usr/bin:

awk -F: '{ print $3 }' /etc/passwd | sort -n

But that’s not as fun :P