How to List User Accounts Using Terminal on Your Mac

You can reach the user accounts on a Mac via the System Preferences panel, found by clicking on the Apple logo located at the top-left of your screen. Nonetheless, there might be instances where you need to comprehensively list the users on your Mac within a Terminal window. Several reasons might necessitate such action and if you ever find yourself in that situation, this is the correct procedure for you.

Terminal does have a command that lets you access the list of the users on your Mac. By executing the command, you’re presenting yourself to all the users that hold an account on your machine. Not only is this account limited to showing regular users, but it’ll also show the system accounts that you normally don’t have access to. Your Mac automatically creates this system accounts for its own use and it doesn’t let you interfere with them.

Read also: How to Remove a User Account on Your Mac

So, here’s how you can go about finding out all the user accounts on your Mac using a command:

Listing the User Accounts using Terminal on Your Mac

1. Launch Terminal on your Mac. You can either use Spotlight or the Launchpad to find and launch the app.

Listing the User Accounts

2. When Terminal launches, type in the following command into it and hit Enter:

dscl . list /Users

Listing the User Accounts

3. As soon as the command’s executed, you should see all of the users that exist on your system. You’ll notice that there’re a number of accounts in the list that you haven’t created yourself. Those are actually processes and other system stuff.

Listing the User Accounts

If you’d like to only see the actual user accounts as most end-users would, you can exclude the other accounts from showing up in the list using the following command:

dscl . list /Users | grep -v '_'

Listing the User Accounts

4. You’ll now only see the user accounts on your screen and not any other stuff. You will, however, find some accounts that aren’t yours, but those have been created for some tasks by the OS.

Listing the User Accounts

5. Not only does Terminal let you see all user accounts, but it also shows you other information about those accounts as well. This contains the user’s directories, and so on.

To access that, enter the following command into Terminal and press Enter.

dscacheutil -q user

Listing the User Accounts 4

6. You now have all the information you want on your Terminal screen.

Listing the User Accounts

So, that’s how you can access the list of all the user accounts on a Mac using a simple command in Terminal.

While you may not always want to use the command only to list users, it’s definitely a great thing to get a list of all the user accounts with a simple command. And as you’ve seen, it lets you see all those hidden accounts that the OS has created on your machine. You would’ve never seen them had you not used the Terminal app.

Terminal also lets you make changes to these user accounts, but that’s out of the scope of this article. It’s possible, though.

Let us know if this helped you reveal all the accounts on your Mac!

Read more like this

4/5 - (4 votes)

Solomen
Solomen

Solomen is the founder of MrHow.io, and he is happiest when working with technology and able to help others. In his free time, he often listens to Baroque music, swims or runs. Feel free to contact him on social media!

Subscribe
Notify of
guest

1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Lee

Thank you so much. I’ve just gotten my first look at what in the world is on the Terminal. I don’t know what it all means yet but it sure is interesting. I took courses from very knowlegeable people years ago and have never gotten past the former owner’s name on my reused computer although trying to get started numerous times over the years. Thank you again. Lee

MrHow - Tutorials Related To Windows, Mac, iOS & Android
Logo