Print all users on a Unix-like system
This python one-liner print all the users on a unix-like system by reading passwd file
Python: 3.0    Anurag Rana    06 Sep 2021   0
Login to upvote
1
print('\n'.join(line.split(":",1)[0] for line in open("/etc/passwd")))
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com