Claude Code is an AI-powered coding assistant developed by Anthropic that brings the power of AI directly into the Linux terminal. Unlike traditional AI chatbots, Claude Code can understand an entire codebase, write and modify source code, debug errors, execute terminal commands, and help automate various development tasks.
I have been exploring different AI-powered development tools, and Claude Code is one of the most interesting options for developers who prefer working directly from the terminal. It can simplify everyday development tasks, whether we are building a new application, troubleshooting an existing project, or managing a large codebase. You can even install Hermes on Linux that works for Free on your local machine.
In this tutorial, I’ll walk you through the process of installing Claude Code on Ubuntu. We’ll use the official native installer provided by Anthropic, which makes the installation process straightforward and eliminates the need to install Node.js separately.
Let’s get started!
Table of Contents
Prerequisites
Before installing Claude Code on Ubuntu, let’s make sure we have the following requirements ready.
- Ubuntu 20.04 or a newer supported release.
- At least 4 GB of RAM.
- An active internet connection.
- Access to the Ubuntu terminal.
curland Bash installed on the system.- A Claude subscription that includes Claude Code access, or an Anthropic Console account with API billing enabled.
Note: A free Claude.ai account does not automatically include Claude Code access. We need an eligible paid plan or an appropriately configured API account.
Step 1: Update Ubuntu
First, let’s update our Ubuntu system to ensure that all installed packages are up to date.
Open the terminal and execute the following command:
sudo apt update && sudo apt upgrade -y
This command refreshes the package repository information and installs available package updates.
Once the update process is complete, we can proceed with installing the required dependencies.
Step 2: Install curl and Bash
Before installing Claude Code, let’s make sure that curl and bash are installed on our Ubuntu system.
Both utilities are important for the installation process:
- curl: A command-line utility used to transfer data from URLs. We will use it to download the official Claude Code installation script.
- Bash: A command-line shell that executes the installation script and provides the required shell environment.
Ubuntu usually comes with Bash preinstalled, but let’s install both packages to avoid any missing dependency issues.
Execute the following command:
sudo apt install curl bash -y
Once the installation completes, let’s verify that both packages are available. The best way is to check the version of both.
Check the curl version:
curl --version
Check the Bash version:
bash --version
If both commands display their respective version information, we are ready to proceed.
Step 3: Install Claude Code on Ubuntu
Anthropic provides an official native installation script that automatically downloads and configures Claude Code on Ubuntu.
This is the recommended installation method because it installs a native binary, does not require a separate Node.js installation, and supports automatic background updates.
Let’s open the terminal and execute the following command:
curl -fsSL https://claude.ai/install.sh | bash
The installation script will download the necessary files and configure Claude Code on our system.
Wait for the installation process to finish. Once completed, Claude Code should be installed successfully.
Note: The native installer generally places the Claude Code executable in ~/.local/bin/claude and stores its supporting files under ~/.local/share/claude. It does not require root privileges.
Step 4: Verify the Claude Code Installation
Now that we have installed Claude Code, let’s verify whether it is working correctly.
Execute the following command in the terminal:
claude --version
If everything is installed correctly, the terminal will display the installed Claude Code version.
We can also perform a more comprehensive installation check using:
claude doctor
This command checks the installation and helps identify potential configuration or environment-related issues.
If both commands work as expected, we are ready to start using Claude Code.
Troubleshooting: If the terminal displays claude: command not found, open a new terminal window and try again. If the issue persists, we may need to add the Claude Code installation directory to our system’s PATH.
- For Bash users, execute:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Now try running claude --version again.
Step 5: Launch Claude Code on Ubuntu
Let’s launch Claude Code for the first time.
Simply execute the following command:
claude
On the first launch, Claude Code will prompt us to authenticate our account.
Follow the on-screen instructions to complete the authentication process.
For users with a Claude subscription:
We can use the browser-based login option and authorize Claude Code using our eligible Claude account. Complete the authentication process in the browser when prompted.
For users with an Anthropic Console API key:
We can configure our API key using the following command:
export ANTHROPIC_API_KEY="your-api-key"
Note: Replace "your-api-key" with our actual API key.
Now launch Claude Code:
claude
Claude Code will detect the configured API key and use it to access Anthropic’s API. You may be asked to approve its use when launching the application.
We can now start interacting with Claude directly from our Ubuntu terminal.
Security Tip: Keep your Anthropic API key private. Avoid sharing it publicly or adding it to your project files or source code.
Step 6: Start Using Claude Code
Now that Claude Code is installed and authenticated, let’s try it with a simple project.
First, navigate to the directory containing our project.
For example:
cd ~/my-project
If we don’t have an existing project, we can create a new directory:
mkdir my-project
cd my-project
Next, launch Claude Code:
claude
Claude Code will start working within the current project directory.
We can now provide instructions in natural language. For example, let’s ask Claude to understand our project:
Analyze this project and explain its directory structure,
important files, and technologies used.
Claude will examine the project and provide an explanation based on its contents.
We can also ask it to perform various development tasks, such as:
- Create a new application or feature.
- Identify and fix programming errors.
- Optimize existing source code.
- Write project documentation.
- Generate scripts and automate repetitive tasks.
- Review code for potential security issues.
That’s it! We have successfully installed and launched Claude Code on Ubuntu.
How to Update Claude Code on Ubuntu
One of the advantages of using the native installer is that Claude Code supports automatic background updates.
It periodically checks for available updates and installs them automatically.
However, if we want to manually check for and install available updates, we can execute:
claude update
This will update Claude Code to the latest available version.
How to Uninstall Claude Code from Ubuntu
If we no longer need Claude Code, we can remove it from our Ubuntu system.
For a native installation, execute the following commands:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
This removes the Claude Code executable and its supporting installation files.
Note: Keep in mind that these commands do not necessarily remove all user configuration, authentication data, or project-related files.
Conclusion
Claude Code makes AI-assisted development more accessible by bringing an intelligent coding assistant directly into the Ubuntu terminal.
In this tutorial, we installed the required dependencies, including curl and Bash, installed Claude Code using Anthropic’s official native installer, verified the installation, authenticated our account, and launched our first coding session.
The best part is that we don’t need to install or configure Node.js separately when using the native installation method.
If you regularly work with Ubuntu and development projects, Claude Code is definitely worth exploring.
Frequently asked questions
Is Claude Code free to use on Ubuntu?
Claude Code is not completely free. You need an eligible Claude subscription or an Anthropic Console account with API billing enabled. If you use the API, charges depend on your token consumption and selected model.
Can I use Claude Code without an internet connection?
No. Claude Code requires an active internet connection to communicate with Anthropic’s services and process requests. It cannot operate as a fully offline AI coding assistant.
Can Claude Code modify files and execute commands on Ubuntu?
Yes. Claude Code can read, create, and modify project files, execute terminal commands, run tests, and help debug applications. However, it may request permission before performing certain actions, depending on the configured permission mode. We should always review commands and changes before approving them.