kędzior

Install latest cURL - Command Line Tool on Linux

Install latest cURL - Command Line Tool on Linux
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:

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

Gry Najlepsze gry w laboratorium aplikacji Oculus
Najlepsze gry w laboratorium aplikacji Oculus
Jeśli jesteś posiadaczem gogli Oculus, musisz wiedzieć o sideloadingu. Sideloading to proces instalowania w zestawie nagłownym treści innych niż sklep...
Gry Top 10 Games to Play on Ubuntu
Top 10 Games to Play on Ubuntu
Windows platform has been one of the dominating platforms for gaming because of the huge percentage of games that are developing today to natively sup...
Gry 5 najlepszych gier zręcznościowych dla systemu Linux
5 najlepszych gier zręcznościowych dla systemu Linux
W dzisiejszych czasach komputery to poważne maszyny używane do gier. Jeśli nie możesz uzyskać nowego wysokiego wyniku, będziesz wiedział, o co mi chod...