Skip to main content

Terminal Commands Every Mac Owner Should Know — and Three to Avoid

Carl HamiltonBy Carl HamiltonFounder, Hamilton Group
10 Aug 2026
Media Terminal Commands Every Mac Owner Should Know — and Three to Avoid

 

Terminal is one of the most powerful applications built into macOS.

It can tell you:

how much storage is available

which Mac model and chip you have

whether your internet connection is responsive

where a file is located

which disks are attached

whether macOS updates are available


For IT professionals, Terminal goes considerably further.

But there is an important difference between Terminal and most graphical applications:

Terminal assumes you mean what you type.

A command aimed at the wrong folder can remove information, change permissions or alter system configuration extremely quickly.

The goal therefore isn't to memorise hundreds of commands.

It is to know a small collection of useful, low-risk commands and recognise the commands that deserve much more caution.

Opening Terminal

Open:

Applications > Utilities > Terminal

or press:

Command + Space

type:

Terminal

and press Return.

Current macOS versions normally use zsh as the default interactive shell.

Before using unfamiliar commands, remember that:

~
means your home folder.

.
means your current directory.

..
means the directory above it.

/
means the top of the filesystem.

That final one is particularly important.

There is an enormous difference between operating inside:

~/Downloads

and:

/

1. pwd — Find Out Where You Are

One of the safest commands is:

pwd

It means:

print working directory

You might see:

/Users/carl/Documents

This tells you which folder your Terminal session is currently using.

Use it before:

copying

moving

renaming

running scripts


particularly when the next command changes files.

A good Terminal habit is:

pwd
ls

before making an important change.

2. ls — See What Is in a Folder

Run:

ls

for a basic directory listing.

For something more useful:

ls -lah

This includes:

hidden items

permissions

owners

readable file sizes


To inspect another folder without moving into it:

ls -lah ~/Downloads

Files beginning with . are normally hidden.

Do not assume they are unnecessary simply because Finder normally hides them.

Many applications store important configuration in hidden files and folders.

3. cd — Move Around

To move to Documents:

cd ~/Documents

To move up one level:

cd ..

To return home:

cd ~

For folder names containing spaces, quote the path:

cd "~/Documents/Customer Projects"

Then verify it:

pwd

An even safer Mac trick is to drag a folder from Finder into Terminal.

macOS inserts its complete path automatically, reducing typing mistakes.

4. open — Jump Back Into Finder

This is one of the most useful Mac-specific-feeling commands.

To open the current directory in Finder:

open .

To open Downloads:

open ~/Downloads

To open a PDF:

open "~/Documents/Report.pdf"

To launch an application:

open -a "Activity Monitor"

It is particularly useful when Terminal helps you locate something but you would rather continue working with it graphically.

5. df -h — Check Available Storage

Run:

df -h /

to inspect available storage on the startup filesystem.

The -h option displays sizes in human-readable units.

For ordinary users:

System Settings > General > Storage

is easier to interpret.

But df is extremely useful during troubleshooting because it quickly answers:

Is the filesystem genuinely close to full?

A nearly full startup disk can contribute to:

macOS update failures

application problems

poor performance

backup problems


Do not start deleting random files based purely on this result.

Use it to establish whether storage is actually the problem.

6. du — Find Large Folders

Suppose Downloads seems enormous.

Run:

du -sh ~/Downloads/*

This gives you an approximate size for each item.

You might discover:

14G    Old Virtual Machine
8.2G   Videos
4.1G   Installer Archive

That is useful evidence.

But:

large ≠ safe to delete.

Be particularly careful with:

virtual machines

Outlook data

Photos libraries

application databases

creative projects


Use du to identify what deserves investigation.

Then remove it through Finder or the application that created it where practical.

7. mdfind — Use Spotlight From Terminal

macOS already has a powerful search index.

Terminal can use it through:

mdfind

For example:

mdfind -name "quarterly report"

or:

mdfind 'kind:pdf "Hamilton Group"'

This can be much faster than recursively searching an entire disk because Spotlight has already indexed much of the content.

If something does not appear, remember that:

the location may be excluded from Spotlight

the disk may not be indexed

network storage may behave differently


For conventional file searches, Finder and Spotlight are often still easier.

8. find — Search More Precisely

When you need conditions Spotlight cannot easily provide, use find.

Find PDF files:

find ~/Documents -type f -name "*.pdf"

Case-insensitive name search:

find ~/Documents -type f -iname "*proposal*.pdf"

Find files larger than 500 MB:

find ~/Downloads -type f -size +500M -print

Notice that these examples only print results.

find becomes far more dangerous when combined with:

-delete

-exec


So preview the matches first.

9. system_profiler — Find Out What Mac You Actually Have

For hardware information:

system_profiler SPHardwareDataType

For macOS information:

system_profiler SPSoftwareDataType

For storage:

system_profiler SPStorageDataType

This can provide IT support with:

Mac model

processor/chip

memory

operating-system information

storage details


Avoid posting an unedited complete system report publicly.

Diagnostic output can contain information you may not want to publish.

10. diskutil list — See Disks and APFS Volumes

This is one I would bring forward in the rewritten article because it is genuinely useful on a Mac.

Run:

diskutil list

It displays attached storage devices, partitions and APFS containers/volumes.

This is useful when:

external drive does not appear in Finder

USB disk is behaving strangely

you need to identify a disk before using Disk Utility

you are investigating storage layout


Viewing the information is safe.

Be far more cautious with diskutil commands involving:

erase

partition

apfs delete

reformatting


For ordinary disk formatting, the graphical:

Disk Utility

is generally the safer choice.

11. networkQuality — Test More Than Download Speed

Modern macOS includes:

networkQuality

This tests internet:

download capacity

upload capacity

responsiveness


That final measurement is particularly useful.

A connection can achieve a good headline download speed while still performing badly for:

Teams

Zoom

VoIP

interactive cloud applications


because latency or responsiveness is poor.

Run several tests rather than judging the network from one result.

Also compare:

Wi-Fi vs Ethernet

where possible.

12. ping — Test Basic Connectivity

For five tests to an IP address:

ping -c 5 1.1.1.1

For a hostname:

ping -c 5 apple.com

This can provide a quick indication of:

connectivity

latency

packet loss


But remember:

failed ping does not automatically mean the destination is down.

Some hosts deliberately ignore ICMP echo requests.

It is one diagnostic tool, not a complete network test.

13. softwareupdate --list — Check Available Apple Updates

Run:

softwareupdate --list

to see which Apple software updates macOS currently considers available.

For ordinary users, Apple still recommends:

System Settings > General > Software Update

and advises backing up before significant software installation.

On a company-managed Mac, do not use Terminal to bypass update deferrals or management policy.

IT may deliberately be:

testing compatibility

staging a rollout

delaying a major upgrade


Checking is one thing.

Forcing an upgrade is another.

14. tmutil — Check Time Machine

For Macs using Time Machine:

tmutil latestbackup

can identify the most recent available backup.

You can also inspect Time Machine configuration with commands such as:

tmutil destinationinfo

For ordinary backup configuration and recovery, Apple's graphical Time Machine controls remain easier.

But tmutil is extremely useful diagnostically.

The important point is:

Do not start deleting Time Machine snapshots with copied Terminal commands simply because System Data looks large.

macOS and Time Machine manage local snapshots automatically in many circumstances.

Investigate first.

15. caffeinate — Keep the Mac Awake Temporarily

To stop a Mac sleeping for one hour:

caffeinate -t 3600

This can be useful during:

downloads

diagnostics

large transfers

long-running Terminal processes


When the timer expires, normal power behaviour resumes.

Do not use it to keep a laptop permanently awake—particularly inside a bag where heat cannot escape properly.

16. man — Understand Before Running

Perhaps the most important command is:

man

For example:

man diskutil

or:

man find

This opens the built-in manual page.

Use:

Space — forward
B — backwards
Q — quit

If an internet guide tells you to run a command you do not understand, read its manual before executing it.

Terminal commands should become more understandable as you investigate them—not less.

Three Types of Terminal Commands to Avoid

There are legitimate expert uses for all of the following.

That does not make them sensible everyday troubleshooting commands.

1. Avoid Casual sudo rm -rf

A command such as:

sudo rm -rf [path]

combines several powerful behaviours:

sudo
→ elevated privileges.

rm
→ delete.

-r
→ recursively process folders.

-f
→ force the operation.

That makes a typing error potentially expensive.

For ordinary file deletion, use:

Finder > Move to Bin

because it provides much more visible context and easier recovery.

If you genuinely need recursive command-line deletion:

verify the target first.

Run:

pwd
ls -lah "target"

and make sure you understand exactly what will disappear.

2. Avoid chmod -R 777 as a Permission Fix

You will frequently find this suggested online:

chmod -R 777 [folder]

It broadly grants extremely permissive access recursively.

That is not a proper solution to:

Permission denied.

It may:

expose data

allow unwanted changes

alter application behaviour

hide the original permissions problem


The correct question is:

Why does this user not have access?

Possible answers include:

ownership

filesystem permissions

macOS Privacy controls

network permissions

cloud permissions

MDM policy


Fix the correct layer.

3. Avoid Disabling macOS Security to Make an App Work

Be extremely cautious with instructions involving things such as:

csrutil disable

or commands intended to:

disable Gatekeeper

remove quarantine protections broadly

disable security extensions

circumvent MDM

weaken endpoint protection


If macOS blocks an application, first determine:

where it came from

whether the developer is trusted

why macOS objected

whether an approved version exists


Do not weaken security across the entire Mac merely to launch one questionable application.

This is especially important on business Macs.

Be Suspicious of curl ... | sudo sh

Commands resembling:

curl https://example.com/script.sh | sudo sh

download a script and feed it directly into an elevated shell.

You may never inspect what you are executing.

A safer workflow is:

curl -o script.sh https://example.com/script.sh

then inspect it before considering execution.

This does not make every downloaded script trustworthy.

It simply gives you a chance to understand what it contains.

Company Macs Need Extra Caution

A business Mac may be managed through:

Microsoft Intune

Apple device management

endpoint security

configuration profiles


Employees should not use Terminal to bypass:

management profiles

FileVault

security software

application restrictions

update policies

network settings


If Terminal says:

Operation not permitted

or macOS prevents a change, do not immediately treat that as something to circumvent.

There may be a deliberate security reason.

A Practical Mac Terminal Starter Kit

For most Mac users, these commands provide plenty of useful diagnostic capability:

pwd
ls -lah
open .
df -h /
du -sh ~/Downloads/*
mdfind -name "filename"
system_profiler SPHardwareDataType
diskutil list
networkQuality
ping -c 5 apple.com
softwareupdate --list
tmutil latestbackup
man diskutil

These answer useful questions without making unnecessary system changes.

The rule is simple:

Use Terminal to inspect first. Change things second.

How Hamilton Group Can Help

Terminal can be extremely useful for diagnosing a Mac, but command-line access also removes many of the safeguards provided by graphical applications.

Hamilton Group can help businesses with:

macOS troubleshooting

Apple device support

Terminal diagnostics

Microsoft Intune for Mac

FileVault

application deployment

software updates

backup and recovery

networking

endpoint security


For business Macs, command-line administration should be part of a controlled management process rather than employees copying administrator commands from random internet posts.

Visit hgmssp.com or call 01423 438 953 to discuss Mac and Apple business support.

Carl Hamilton
About the author
Carl Hamilton
Founder, Hamilton Group
Carl Hamilton is the founder of Hamilton Group, a UK managed IT services provider helping small and medium businesses stay secure, productive and well supported with proactive IT, cyber security and Microsoft 365 expertise.

0 comments

  1. Be the first to comment.

Join the conversation

Comments are checked before they appear.

Your email stays private; we never publish it. By commenting you agree to our acceptable-use terms.