Skip to content

Getting Started with Claude CLI

Understand how Claude works

Claude works inside the directory where it is launched.

For example:

~/website

If you start Claude from this folder, it can inspect and work with files inside that project.

If you instead launch Claude inside:

~/minecraft-server

Claude will work with that project instead.

Because of this, it is recommended to always change into the correct project directory before starting Claude.

Example:

cd ~/website
claude

Start Claude

Launch the interactive interface:

claude

Claude opens an interactive chat inside your terminal.

You can now ask it questions such as:

Explain this project.

What files are most important?

How do I start this application?

Find potential bugs.

Improve this code.

Update my documentation.

Run a single prompt

If you don't want the interactive interface, you can execute a single request.

Example:

claude -p "Explain this project."

Another example:

claude -p "Review every Python file and list possible improvements."

This is useful for automation and scripting.

Create a new project

Create a project folder:

mkdir my-project
cd my-project

Then launch Claude:

claude

You can ask:

Create a Flask web application.

or

Build a simple Node.js REST API.

Claude will propose the required files and code.

Work with existing projects

Navigate to your project:

cd ~/my-project

Start Claude:

claude

Examples:

  • Explain this project.
  • Summarize the folder structure.
  • Find dead code.
  • Improve performance.
  • Refactor this application.
  • Update dependencies.
  • Review my Docker configuration.
  • Explain this error.

Claude understands the current directory structure and can work across multiple files.

Common tasks

Claude is particularly useful for:

Explaining Code

Explain how authentication works.

Finding Bugs

Find possible bugs in this project.

Writing Documentation

Generate a README.md.

Reviewing Code

Review my project like a senior developer.

Creating Files

Create a Docker Compose configuration.

Refactoring

Refactor this code into reusable functions.

Learning

Explain this code as if I'm a beginner.

Work safely

Claude may request permission before:

  • Editing files
  • Running commands
  • Installing packages
  • Removing files

Always review proposed actions before approving them.

Using Git before making large changes is strongly recommended.

Review everything before committing.

Update Claude Code

Update to the newest version:

npm update -g @anthropic-ai/claude-code

Verify:

claude --version

Sign out

Disconnect Claude from your account:

claude auth logout

Verify:

claude auth status --text

Useful commands

Check version:

claude --version

Authentication status:

claude auth status --text

Interactive mode:

claude

Single prompt:

claude -p "Hello"

Display help:

claude --help

Best practices

For the best experience:

  • Launch Claude inside the correct project directory.
  • Use Git before making significant changes.
  • Review all generated code before deploying it.
  • Keep Claude updated.
  • Avoid running Claude as the root user unless necessary.
  • Break large requests into smaller tasks for better results.
  • Let Claude inspect your project before asking it to make changes.

Conclusion

Claude Code brings Anthropic's AI directly into your Linux terminal, allowing you to work faster without leaving your development environment. Whether you're creating a new application, debugging an existing project, writing documentation, or learning how unfamiliar code works, Claude can significantly improve your development workflow.

For the safest experience, always work inside a Git repository, review every proposed change, and keep your projects backed up before making large modifications.