List of All user accounts from command line
Hello,
Is there a way of listing all the users of a system from the command line? I cannot find anything that will list users even if they are not logged in, I would like to sort them by uid and stuff if possible. The particular server is running FC5 but it would be good if it was general. Cheers, Phil |
cat /etc/passwd
or getent passwd |
Hello,
Thank you, just what I needed. Cheers, Phil |
The /etc/passwd file will also contain system users. You could filter out the users how don't have a home directory.
sudo cat /etc/passwd | grep '/home' |
You could then trim this down even further to only recieve each username instead of the whole line.
Code:
sudo cat /etc/passwd | grep '/home' | cut -d : -f 1 |
All times are GMT -5. The time now is 08:37 PM. |