Install latest cURL – Command Line Tool on Linux

28/12/2020
Chưa phân loại
cURL is an open source, command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. It supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks. It’s used in command lines or scripts to transfer data. It is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, settop boxes, media players.

In addition to wget, curl is a primary tool in the linux guru’s tool chest when webscraping, poking around the internet or intranet, downloading files, testing applications and making web calls via a CLI tool.

Curl is actively developed by a community of developers and has its web presence at https://curl.haxx.se/.

A Quick look at some Feature Highlights of Curl:

  • config file support
  • multiple URLs in a single command line
  • range “globbing” support: [0-13], {one,two,three}
  • multiple file upload on a single command line
  • custom maximum transfer rate
  • FTP download, authentication
  • Kerberos 5 (*14)
  • active/passive using PORT, EPRT, PASV or EPSV
  • single file size information (compare to HTTP HEAD)
  • upload via http-proxy as HTTP PUT
  • download / upload resume
  • all operations can be tunneled through a http-proxy
  • customizable to retrieve file modification date
  • SCP both password and public key auth
  • SFTP both password and public key auth
  • SFTP with custom commands sent before/after the transfer
  • TELNET connection negotiation
  • custom telnet options
  • TELNET stdin/stdout I/O
  • full LDAP URL support
  • SMBv1 over TCP and SSL
  • SMB download & upload
  • SMB authentication with NTLMv1
  • SMTP authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (*9), Kerberos 5, (*4) and External.
  • send e-mails
  • mail auth support for trusted server-to-server relaying
  • SMTP multiple recipients
  • POP3 authentication: Clear Text, APOP and SASL
  • SASL based authentication: Plain, Login, CRAM-MD5, Digest-MD5, NTLM (*9), Kerberos 5 (*4) and External.
  • list e-mails
  • retrieve e-mails

For more features

Latest Curl Release

The latest version of curl as of Jan 2020 is 7.68.0. Downloads are posted on the curl site and the source code can be found on the github page for the project. See the Changelog for the latest curl Release Notes.

How to build and install Curl from source

First get the source code for curl from the download page. I won’t demo this because likely you need curl or wget to get the source code and that is redundant to show in this tutorial. See the downloaded software below:

Also you will need to install GCC and make on your machine before starting, let’s assume its Debian or compatible:

  $ apt-get install gcc  $ apt-get install make  

Now unpack the software with the tar command. And then enter the unpacked directory and run configure and make and make install

  $ tar xzvf curl-7.68.0.tar.gz  $ cd curl-7.68.0  $ ./configure  $ make  $ sudo make install  

If you get this warning, you may have 2 versions of curl installed and need to ensure you are using the libcurl you just compiled with the curl version you compiled. So set the LD_LIBRARY_PATH to fix it:

  WARNING: curl and libcurl versions do not match. Functionality may be affected.  $ export LD_LIBRARY_PATH=/usr/local/lib  

Now you can see curl and libcurl have matching versions and curl is working as expected.

How to install Curl on Debian 10 or Ubuntu 19.10

Curl is installed by default on Debian and Ubuntu latest versions. If you have removed it for some reason you can install it with apt-get

  sudo apt-get install curl  

How to install Curl on CentOS 8

Curl is installed by default on CentoOS and Red Hat latest versions. If you have removed it for some reason you can install it with yum

  sudo yum install curl  

Download WebPage with Curl Example

Let’s download a simple webpage with curl. Here is the syntax and example:

  curl https://linuxhint.com/sitemap.xml > out.webpage  head out.webpage  

Multi-Page Download Example

You can use wildcards and fancy syntax to download many files at once. Here is an example to download from Linuxhint the sitemap pages which follow a regular pattern. The -O option will store the files in names that are the same as the original web pages but locally.

  curl -O https://linuxhint.com/sitemap-pt-post-2019-[01-12].xml  

Conclusion

Curl is mostly installed on most modern Linux distributions by default so getting access to it is super easy. Compilation or package install is also easy. Check the resources below for more details on all the abundant features of curl.

More Curl Resources

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install Pokemon Online – Pokemon Battle Simulator on Linux

Pokemon Online is one of the most accurate, popular and complete Pokemon battle simulator. Pokemon Online is available in...
28/12/2020

Redirecting HTTP to HTTPS

Whether you are using self-signed certs, or certs from well-know CA you need a way to integrate it with your services....
29/12/2020

Installing Eclipse IDE on Debian 10

Eclipse is a professional software development IDE. Eclipse has IDE for different type of software development, i.e. Java...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Hướng Dẫn Chọn Dịch Vụ Thuê Địa Chỉ IPv4
10/03/2025

Reliable IPv4 and IPv6 Subnet Rental Services: The Perfect Solution for Global Businesses
23/12/2024

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024