Red Hat, Fedora, Gnome, KDE, MySQL, PostgreSQL, PostGIS, Slony, Zarafa, Scalix, SugarCRM, vtiger, CITADEL,OpenOffice, LibreOffice,Wine, Apache, hadoop, Nginx Drupla, Joomla, Jboss, Wordpress, WebGUI, Tomcat, TiKi WiKi, Wikimedia, SpamAssassin, ClamAV, OpenLDAP, OTRS, RT, Samba, Cyrus, Dovecot, Exim, Postfix, sendmail, Amanda, Bacula, DRBD, Heartbeat, Keepalived, Nagios, Zabbix, Zenoss,
alias lsusers='getent passwd | tr ":" " " | awk "\$3 >= $(grep UID_MIN /etc/login.defs | cut -d " " -f 2) { print \$1 }" | sort'
Above command to list non-system users. It should be portable though won't work on systems without the getent command.
Some improvements:{ if command -v getent > /dev/null; then getent passwd; else cat /etc/passwd; fi; } | awk -F: "\$3 >= $(awk '$1 == "UID_MIN" { print $2 }' /etc/login.defs 2>/dev/null || echo 1000) && \$1 != \"nobody\" { print \$1 }" | LC_ALL=C sort
Post a Comment
1 comment:
Some improvements:
{ if command -v getent > /dev/null; then getent passwd; else cat /etc/passwd; fi; } | awk -F: "\$3 >= $(awk '$1 == "UID_MIN" { print $2 }' /etc/login.defs 2>/dev/null || echo 1000) && \$1 != \"nobody\" { print \$1 }" | LC_ALL=C sort
Post a Comment