Hamsa K
4 min read | 3 years ago

How to Install Curl on Linux

Install Curl on Centos/RHEL/Fedora and Ubuntu/Debian

Curl is free and open source software and is used in command lines or scripts to transfer data.It is command line tool and library fot transferring data with urls.

It is a command line tool that allows you to transfer data from or to a remote server using the following supported protocols: IMAP, IMAPS, POP, POP3, POP3S, DICT, FILE HTTP, HTTPS, SMB, SMBS, SMTP, SMTPS, FTP, FTPS, RTSP, RMTP,TELNET and TFTP.

on centos/Rhel/Fedora

generally curl comes with preinstalled on latest distros.If it is not installed on your system then you can run following command.

[root@centos ~]# yum install curl

you can check what pakages are installed with below command

[root@centos ~]# rpm -qa | grep curl

If you want to install latest version then you can download and compile it.

[root@centos ~]# wget https://curl.haxx.se/download/curl-7.69.1.tar.gz
[root@centos ~]# tar -xvzf curl-7.69.1.tar.gz
[root@centos ~]# cd curl-7.69.1/
[root@centos curl-7.69.1]# ./configure 
[root@centos curl-7.69.1]# make
[root@centos curl-7.69.1]# make install
[root@centos curl-7.69.1]# curl --version

Also Read -> Find command examples in Linux

For ubuntu/Debian

Curl package is included in the default Ubuntu 18.04 repositories.If it is not there then you can install with following commands.

apt-get update
apt-get install curl

verify curl is installed and check its version like below

dpkg -l curl

For Opensuse

zypper install curl

For ArchLinux

pacman -Sy curl

usage of curl

once curl is installed you can use it as follows to see the headers

Below commnad will print the source-code of the google.com homepage in your terminal window

curl https://google.com

To download a file with curl you can use either the -o or -O options.

If you use lowercase -o then result will be saved in the filename provided in the command line.If it is uppercase -O option that time filename in the URL will be taken and it will be used as the filename to store the result.

curl -o curl.tar.gz https://curl.haxx.se/download/curl-7.69.1.tar.gz

you can check more information using below commands.

[root@centos ~]# man curl
[root@centos ~]# curl --help


Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy