Agentic Research

sudo (superuser do)

Also: 超級使用者 · root · 管理員權限 · run as administrator · sudo 是什麼

Run this one command as the administrator (root): the command stays the same, the identity changes.

When you will meet it

Mid-install you hit "Permission denied" and the standard answer online is "put sudo in front". It often works instantly, so the habit forms — and the damage is deferred: files created under sudo belong to root, so your normal user cannot touch them later, and tools like Homebrew refuse to run as root at all. Asking "why was this denied?" before escalating is the line between beginner and competent.

An analogy

Like borrowing the building manager's master key to open your own front door. It opens — but whatever you then carry into the hallway is carried as the manager, and your ordinary self cannot move it later.

Minimal example

whoami         # 你現在是誰:印出你的帳號名
sudo whoami    # 同一個指令、以管理員身分執行 → root

Two details: sudo asks for YOUR login password (not root's), and nothing appears on screen while you type — that is normal, not a broken keyboard; press Enter when done. Windows has no sudo; the equivalent is "Run as administrator".

What people get wrong

  • Prefixing sudo reflexively when something will not run. Read the error first: most "Permission denied" cases are permission bits or ownership, cured by chmod/chown. Escalating only buries the real cause one layer deeper.
  • Running everyday tools under sudo — brew, npm, pip, agent CLIs alike. Their output files become root-owned, so the next unprivileged run fails, you add sudo again, and ownership gets worse each round. Nearly every package manager warns against it; Homebrew refuses outright.

Related terms

Next