Claude Code is Anthropic’s agentic coding tool for the terminal. It can understand a codebase, propose edits, run tests, and help with Git workflows. This guide keeps the setup simple and uses copy-ready commands.
Requirements: Ubuntu 20.04+ or Debian 10+, at least 4 GB RAM, internet access, and Node.js 18 or newer.
1. Install Node.js and Git
sudo apt update
sudo apt install -y nodejs npm git
node --version
npm --version
git --versionExpected: Each command prints a version. If Node is older than version 18, install a current Node.js release using your organization’s approved Node source before continuing.
2. Install Claude Code
Install the official package globally as your normal user. Do not use sudo npm install -g.
npm install -g @anthropic-ai/claude-code
claude --versionExpected: npm finishes successfully, followed by a Claude Code version number. If npm reports a permissions error, fix your npm global-prefix setup rather than rerunning with sudo.
3. Check the installation health
claude doctorExpected: Claude Code reports its installation type and any recommended actions.
4. Start Claude Code in a project
mkdir -p ~/Projects/claude-demo
cd ~/Projects/claude-demo
git init
claudeExpected: Claude Code opens its interactive session and asks you to authenticate. Select the option matching your Anthropic Console account, Claude Pro/Max account, or approved enterprise provider. Complete the browser sign-in and return to the terminal.
5. Start with a safe prompt
In the interactive session, ask:
Explain the files in this project. Do not modify files or run shell commands.Expected: Claude describes the repository without making changes. Review every proposed command and edit before approving it.
6. Useful everyday commands
claude "explain this project"
claude -p "list likely test commands for this repository"
claude -c
claude updateclaude "…"starts a session with an initial prompt.claude -p "…"prints a response and exits—useful in scripts.claude -ccontinues the most recent conversation.claude updaterequests the latest version.
7. Protect your project
Make a Git checkpoint before broad agent tasks and inspect changes afterward:
git add -A
git commit -m "Checkpoint before Claude task"
git diff
git statusAvoid --dangerously-skip-permissions unless you fully understand the command and are working in a disposable environment. The official Claude Code setup guide and CLI reference are the source of truth for current options.
