Back to commands

Apple Terminal

Read-only

Show Your PATH One Entry Per Line

A tool runs from an unexpected location because PATH order is unclear.

Command

echo "$PATH" | tr ':' '\n' | nl -ba

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not use it as proof that a command exists. Pair it with command -v for that.

Expected output

A numbered list of PATH directories in search order.

System impact

Read-only. Nothing changes. The command formats PATH for easier reading.

Recovery / rollback: no state is changed.

When to use it

Use when Homebrew, npm, pyenv, rbenv, or Xcode command line tools seem to resolve the wrong executable.

When not to use it

Do not use it as proof that a command exists. Pair it with command -v for that.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ PATH_FIXTURE='/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin'; echo "$PATH_FIXTURE"

/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin

$ PATH_FIXTURE='/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin'; echo "$PATH_FIXTURE" | tr ':' '\n' | nl -ba

     1	/opt/homebrew/bin
     2	/usr/local/bin
     3	/usr/bin
     4	/bin
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. PATH_FIXTURE='/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin'; echo "$PATH_FIXTURE"
  2. PATH_FIXTURE='/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin'; echo "$PATH_FIXTURE" | tr ':' '\n' | nl -ba

next steps

Related commands

Apple Terminal Can be slow

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
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.

  • linuxplus:provisional
  • linuxplus:troubleshooting
  • risk:macos-only
  • risk:read-only

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.