Choose a different version or distribution
Introduction
Before we begin talking about how to install and use Curl
on Ubuntu 18.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 18.04. We will also address a few FAQs on how to install and use Curl on Ubuntu 18.04.
Advantages of Curl
- Versatility:
curl
supports various protocols like HTTP, FTP, and more, allowing users to transfer data seamlessly. - Simplicity: With its user-friendly command-line interface,
curl
is easy to use for both beginners and experienced developers. - Automation:
curl
enables automated data transfers and tasks, saving time and effort for developers and system administrators. - Wide Compatibility:
curl
works on multiple platforms, including Windows, macOS, and Linux, ensuring compatibility across different systems. - Extensibility:
curl
's library and extensive options offer flexibility for customization, making it adaptable to a wide range of use cases.
Installing curl
Curl is available in the Ubuntu 18.04 default repository. Simply type the following command to begin the installation process:
sudo apt install curl
To check if curl
is installed, type curl
and press Enter on your terminal:
curl
You will get an output like below:
curl: try 'curl --help' or 'curl --manual' for more information
You've now completed the installation of curl on your Ubuntu machine.
Using Curl
Curl will display the resource supplied in the [url] the standard output in its most basic form when invoked without any options.
The command following, for example, will print the source code of the example.com
homepage in your terminal window:
curl https://example.com
With Curl, you can use the -o
or -O
parameters to download a file.
You can specify the name of the file you're downloading with lowercase -o
:
curl -o linux.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz
The file will be saved with the original filename if you use uppercase -O
:
curl -O https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz
Curl's ability to fetch only the HTTP headers of a given URL is another helpful feature:
curl -I https://www.ubuntu.com/
Output
HTTP/1.1 200 OK
Date: Tue, 02 Apr 2019 20:47:44 GMT
Server: gunicorn/19.9.0
Strict-Transport-Security: max-age=15768000
X-Hostname: juju-prod45-ubuntu-website-machine-15
Content-Type: text/html; charset=utf-8
Age: 42
X-Cache: HIT from privet.canonical.com
X-Cache-Lookup: HIT from privet.canonical.com:80
Via: 1.1 privet.canonical.com (squid/3.5.12)
You may also use curl to retrieve files from FTP servers that are password protected:
curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/file.tar.gz
FAQs to Install CURL
on Ubuntu 18.04
How can I check if CURL is already installed on my Ubuntu 18.04 system?
Open a terminal and type the following command: curl --version
. If CURL is installed, it will display the version information; otherwise, you'll receive an error message.
Can I install CURL without updating the package lists?
It's generally recommended to update the package lists before installing any software to ensure you get the latest version. However, if you prefer not to update, you can run the command: sudo apt install curl --no-update
.
What version of CURL will be installed on Ubuntu 18.04?
The version of CURL available in the default Ubuntu 18.04 repositories may vary depending on when you install it. However, it will be a stable version that is compatible with Ubuntu 18.04.
Can I install a specific version of CURL on Ubuntu 18.04?
The default repositories usually provide the latest stable version. If you specifically need an older or newer version, you may have to add a third-party repository or compile CURL from source.
How do I uninstall CURL from my Ubuntu 18.04 system?
Open a terminal and execute the command: sudo apt remove curl
. This will remove the CURL package from your system.
Are there any additional packages or dependencies required for CURL to work on Ubuntu 18.04?
No, the CURL package and its dependencies should be automatically installed when you run the installation command mentioned earlier.
Conclusion
Hope this detailed tutorial helped you understand how to install and use Curl on Ubuntu 18.04.
If you have any queries, please leave a comment below and we’ll be happy to respond to them.