//View Tip #258
Similar Tips
» Checksum directory recursively
» Bash function to decompress archives
» Kill matching processes without unnecessary greps and extra sh p
» rc-service alias
» Splitting arguments with read

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
I use the following to list non-system users. It should be portable though won't work on systems without the getent command.

alias lsusers='getent passwd | tr ":" " " | awk "\$3 >= $(grep UID_MIN /etc/login.defs | cut -d " " -f 2) { print \$1 }" | sort'


View Comments »




Comments 

Add your comment

Comments are currently disabled
Here's a slightly improved version:

<pre>alias lsusers='awk -F : "\$3 >= $(grep UID_MIN /etc/login.defs | cut -d " " -f 2) { print \$1 }" /etc/passwd | sort'</pre>
Posted 2009-03-11 01:27:01

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit