Friday, March 29, 2024
HomeTutorialsHow to Install and Use Curl on Linux Distributions: A Beginner's Guide

How to Install and Use Curl on Linux Distributions: A Beginner’s Guide

cURL is one of the most used, safe, and reliable command tools to download and transfer files over a network, FTP, HTTP, SMTP, and other repositories. cURL can be used on both Mac and Linux. It shows and encodes the download data on the console. As a professional Linux user, I have run more than thousands of cURL commands on my Linux shell to download an application, files, GitHub repositories without facing any major issues. If you’re a programmer or software developer, I’m sure you are already a fan of the curl command tool.

cURL on Linux


On Ubuntu, Debian, Fedora, and other distributions, cURL works smoothly and can download files with permission to grab. However, if you face any issues running cURL on your local area network, please try to change the server location on your Ubuntu system. It happened to me a lot, something didn’t work at first, but after shifting the server location to the main server, cURL worked smoothly.

cURL is written in the C programming language and is free software. The full form of cURL is Client URL; it is licensed under MIT and was first released in 1998. In this post, we will see how to install and use cURL on a Ubuntu system.

1. Install cURL on Ubuntu/Debian


Normally in modern and updated Debian-based Linux distributions, cURL comes pre-installed with the OS. However, if you have issues running the cURL, please update your system repository and install it on your machine.

sudo apt update
sudo apt install curl

install curl on linux

When the installation is done, you may now run the following command given below as a root user to verify the Debian package.

# dpkg -l | grep curl

GREP clients URL on ubuntu

2. Install cURL on Fedora/Red Hat


Installing cURl on a Fed Hat or Fedora Linux is pretty similar. If you use a modern Fedora workstation, you can run the following YUM command on your terminal shell to install cURL on your system. The YUM command will also be executable on Red Hat-based Linux systems.

- -
# yum install curl

If you’re using a DNF-based old Fedora system, run the DNF command given below on your terminal shell to install cURL on your system.

sudo dnf install curl

install curl on fedora linux

Finally, when the installation finishes, don’t forget to verify the installation of cURL on your Linux system. The following GREP command will return the types of data that can be downloaded through cURL.

# rpm -qa | grep curl

clients url grep test

If you somehow can’t get cURL on your DNF-based Fedora system, you can try using the Snap commands to install cURL. cURL is available on the Snap store. First, install the Snap daemon on your system, then create a symbolic link to the system.

sudo dnf install snapd
sudo ln -s /var/lib/snapd/snap /snap

Finally, run the following command to install cURL via Snap on your Linux system.

sudo snap install curl-ijohnson --edge

3. Install cURL on SuSE and Arch Linux


As the cURL is already in the Linux repository, it is now easier to install. If you’re using a SuSE Linux, type the following zypper command on the shell to install.

# zypper install curl

When the installation ends, run a quick-verify command to check cURL.

# zypper se curl

The below-mentioned Pacman command will run and install the cURL package on an Arch and Arch-based Linux system.

# pacman -Sy curl

When the installation ends, run a quick-verify command to check cURL.

# pacman -Qi curl

Get Started with cURL


Till now, we have seen how to install cURl on various Linux systems. It’s now time to take a test drive. All the commands that are shown below will be executable in all major Linux distributions. In the beginning, type ‘curl’ and hit the enter button to run Curl on your system.

curl

We can now see a few uses of the cURL on Linux. Use the cURL command to load the source code of a site. cURL can also be used to browse HTTP sites if you know the proper user credentials of that site.

curl https://gnu.org

browser GNU via CURL

With an o flag, cuRL can save files with the default file name. And, with an O-flag, it can download and save the file with the original name.

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

If you need to download a file from an FTP site and protect it with a password, you can use the following cURL command given below.

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

Final Words


No doubt, cURL is a very handy command tool for downloading multiple files, control transfer limits, secure downloads, and load applications. In the entire post, we have seen installing cURL in various Linux distributions and getting started with it. Please share this post with your friends and the Linux community to find this post useful and informative. You can also write down your opinions in the comment section regarding this post.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

You May Like It!

Trending Now