How to List User Accounts Using Terminal on Your Mac
User accounts on a Mac can be accessed from the System Preferences panel that you launch using the Apple logo in the top-left corner of your screen. However, sometimes you’ll want to list out all the users on your Mac in a Terminal window. There could be various reasons as to why you want to do this, but if you want to do it, here’s the right way 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.
2. When Terminal launches, type in the following command into it and hit Enter:
dscl . list /Users
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.
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 '_'
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.
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
6. You now have all the information you want on your Terminal screen.
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
- Jazz Up Your Mac’s Folders and Apps With Custom Icons
- The Advanced Guide to Making the Most of Spotlight
- How to Delete a User Account on Your Mac