Apple Terminal
Read-onlySee Exactly Which Command macOS Will Run
Multiple versions of the same command are installed and the shell may be choosing the wrong one.
Command
command -v node && node -v
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not rely on which alone for shell functions or aliases. command -v is more shell-aware.
Expected output
A filesystem path such as /opt/homebrew/bin/node followed by a version string.
System impact
Read-only. Nothing changes. The command prints the resolved executable path and version.
Recovery / rollback: no state is changed.
When to use it
Use when a CLI behaves like an old or unexpected version.
When not to use it
Do not rely on which alone for shell functions or aliases. command -v is more shell-aware.
Explanation-only example
Illustrated output, not a live lab run
This example is intentionally illustrative. It shows the command shape without killing real processes or changing your machine.
$ printf '%s\n' '/opt/homebrew/bin/node'
/opt/homebrew/bin/node
$ printf '%s\n' '/opt/homebrew/bin/node' 'v22.11.0'
/opt/homebrew/bin/node
v22.11.0
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
printf '%s\n' '/opt/homebrew/bin/node'printf '%s\n' '/opt/homebrew/bin/node' 'v22.11.0'
next steps
Related commands
Show Your PATH One Entry Per Line
Wrong Node, Python, or FFmpeg? Start by reading your PATH clearly.
echo "$PATH" | tr ':' '\n' | nl -ba
Find What Is Using a Local Dev Port
Your dev server says port 3000 is busy. Ask macOS who is holding it.
lsof -nP -iTCP:3000 -sTCP:LISTEN
Find Large Files Inside a Project
Before committing, check whether a huge video, build artifact, or export slipped into your repo.
find . -type f -size +100M -print
Flush macOS DNS Cache
Changed DNS but your Mac still visits the old place? Flush the resolver cache.
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Find Which Folder Is Eating Disk Space
When your Mac is full, start with the biggest folders in the current directory.
du -sh ./* 2>/dev/null | sort -h
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.