May 17, 2023 3 min read

How to Install CURL on Ubuntu 22.04

Install CURL on Ubuntu 22.04 with our step-by-step tutorial. It is a command-line tool that is used to send requests for many protocols.

How to Install CURL on Ubuntu 22.04
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install CURL on Ubuntu 22.04, let's briefly understand – What is curl?

curl is a command-line tool and a library used to transfer data over various protocols like HTTP, FTP, and more. It allows users to send and receive data from servers, making it essential for tasks like downloading files or testing API endpoints.

curl's versatility, simplicity, and wide range of supported protocols make it a popular choice among developers and system administrators. With curl, you can effortlessly handle data transfers and automate tasks, enhancing productivity and efficiency.

In this tutorial, you will install CURL on Ubuntu 22.04.

Advantages of Curl

  1. Versatility: curl supports various protocols like HTTP, FTP, and more, allowing users to transfer data seamlessly.
  2. Simplicity: With its user-friendly command-line interface, curl is easy to use for both beginners and experienced developers.
  3. Automation: curl enables automated data transfers and tasks, saving time and effort for developers and system administrators.
  4. Wide Compatibility: curl works on multiple platforms, including Windows, macOS, and Linux, ensuring compatibility across different systems.
  5. Extensibility: curl's library and extensive options offer flexibility for customization, making it adaptable to a wide range of use cases.

Install curl on Ubuntu 22.04

In case your system is missing this important curl utility, you can download curl with the help of following commands:

sudo apt update
sudo apt install curl

Use curl to see if the installation was successful in your terminal:

curl

You will get an output like below:

Output

curl: try 'curl --help' or 'curl --manual' for more information

Your Ubuntu PC can now use Curl following a successful installation.

How to use CURL

curl publishes the source code of the URL to the standard output when it is used without any further parameters.

For illustration, the following command will show the source code for the gnu.org homepage in your terminal window:

curl https://gnu.org

You can download files using Curl's -o and -O arguments.

The lowercase -o option allows you to provide the name of the saved file:

curl -o linux.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz

Curl saves the file with its original filename when run with uppercase -O:

curl -O https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz

With curl, you can also get only the URL's HTTP headers:

curl -I https://www.gnu.org/

Output

HTTP/1.1 200 OK
Date: Mon, 8 Aug 2022 07:10:35 GMT
Server: Apache/2.4.7
Content-Location: home.html
Vary: negotiate,accept-language,Accept-Encoding
TCN: choice
Strict-Transport-Security: max-age=63072000
Access-Control-Allow-Origin: (null)
Accept-Ranges: bytes
Cache-Control: max-age=0
Expires: Fri, 12 Aug 2022 07:10:35 GMT
Content-Type: text/html
Content-Language: en

When retrieving data from FTP servers that require a password, Curl is frequently used:

curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/file.tar.gz

FAQs to Install CURL on Ubuntu 22.04

How do I check if CURL is already installed on my Ubuntu 22.04 system?

You can check if CURL is installed by running the command: curl --version. If CURL is installed, it will display the version information; otherwise, it will prompt you to install it.

What if the apt-get command doesn't work?

If the apt-get command doesn't work, it's possible that your system's package repository is not properly configured. You can try running sudo apt update to update the package lists and then retry the installation command.

Can I use CURL in my programming language of choice?

Yes, CURL provides libraries and bindings for various programming languages, including Python, PHP, and more. You can integrate CURL into your code to make HTTP requests programmatically.

Are there any additional packages or dependencies required for CURL to work?

Generally, installing CURL on Ubuntu 22.04 will automatically install any necessary dependencies. However, if you encounter any issues, you can use the package manager (apt-get) to install the required dependencies manually.

Can I customize CURL's behavior or add additional options?

Yes, CURL provides a wide range of options and parameters that you can use to customize its behavior. You can refer to the official CURL documentation or use the curl --help command to explore the available options.

How do I uninstall CURL from Ubuntu 22.04?

To uninstall CURL, open a terminal and run the command: sudo apt-get remove curl. This command will remove CURL and any related packages from your system.

Conclusion

Curl is a flexible tool that enables network data transmission and reception. Curl installation on Ubuntu is a rather easy process. Visit Curl Command Example, for more information about the working of this tool.

For any queries feel free to reach back to us, please leave a comment below, and we’ll be happy to respond to them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Blog - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.