5 Mac Terminal Commands You Need to Know

5 Mac Terminal Commands You Need to Know

The terminal is a potent tool to help you navigate your Mac faster. It's important to keep some helpful Mac terminal commands in your arsenal when things get scary. Here's a short list to get you started.


You probably have several accounts with different passwords. It's normal to forget one or two. Thankfully, there are Mac terminal commands for that.

In recovery Mode, start by turning off your Mac. Press and hold Command + R, then press the power button. Keep holding Command + R until there is an Apple logo and progress bar on the screen.

Your Mac will now be in Recovery Mode. In the menu, click Utilities > Terminal. When the window comes up, type resetpassword – exactly how it is, but no quotes. Then press Enter.

Close the Terminal windows and you will find the Reset Password Tool. You’ll see a list of all user accounts on your Mac — if you reset the password for your account, you’ll have to set a new one for every other user, too.

5 Mac Terminal Commands You Need to Know


Have you ever had issues turning off your Mac? There may be an app or background process that's hung up and is causing the shutdown to stall.

Your power button could also be jammed or broken.

There's a command for that. Open the terminal and type: sudo shutdown -h now.

Once you press return, your computer will shut down immediately. On the off chance, it doesn't add sudo before the shutdown command. It will ask for your password but it should shut down.

The command sudo shutdown -r now will perform a restart.

killall Finder

macOS hides specific files to protect them from being accidentally deleted. But if you're looking for something specific, you can view them all in Terminal.

Type defaults write com.apple.finder AppleShowAllFiles -bool TRUE and press Enter,

Then type killall Finder.

Keep in mind these files were originally hidden for a reason, so be careful what you delete.

5 Mac Terminal Commands You Need to Know


Macs can freeze or crash at any time. If you're dealing with an older machine and want to get ahead of things, there's a command for that.

Type sudo systemsetup -setrestartfreeze on.

This will force your Mac to reboot as soon as it senses a full system freeze.

That way, it may make it easier to detect what the problematic app or program is.


Sometimes the DNS cache - the place where recent websites you visit are stored can get full. This can cause connection issues.

If you're having connectivity problems, resetting the Domain Name Server is a great troubleshooting step.

Type sudo dscacheutil -flushcache, then press Enter. You should be prompted to enter a password. For safe measures, you can reboot and see if that resolves the issue.

Wrapping Up

Use the resetpassword command if you're having trouble logging in. The shutdown command can force your Mac to restart if it's not working normally.

You can show all hidden files in the Terminal with killall Finder. Just be careful before deleting system files!

Use setrestartfreeze to force your Mac to reboot if it has freezing issues.

And use flushcache to quickly resolve connectivity issues.

Back to blog