How to list all users in Mac Terminal

If you want a list of all user account names on the Mac using the Terminal, there are multiple ways to do that.

One of the simplest ways is the do do an ls for the /Users directory. The folders you see within it are literally the users that your Mac has.

% ls /Users 
Shared		c2ctech		dev		guest

Just ignore the Shared folder.

As macOS is a Unix-based OS, you will find that all the users are available under the etc/passwd file.

cat /etc/passwd

If you want to have the list of all users including the system users, run the below command in the Terminal.

% dscl . -list /Users

Get the list of Mac Users using Terminal

Facing issues? Have Questions? Post them here! I am happy to answer!

Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap