18 curl command examples in Linux/Unix
What is curl command? The curl command is a powerful command line tool used to transfer data to or from a server. It can use any one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE) for data transfer. In many aspects curl is similar to the wget command but curl is more feature rich as compared to wget. The cURL stands for “See URL“. The curl command is generally available by default on UNIX systems. Let’s verify that we have curl installed. [root@linuxnix ~]# which curl /usr/bin/curl [root@linuxnix ~]# rpm -qf /usr/bin/curl curl-7.19.7-52.el6.x86_64 In case your system does not have curl installed then you can install it manually. If you are using a RedHat based system then type: yum install curl If you are using a Debian based system then type: apt-get install curl In this article, we’ll go through some examples to understand some of the features curl provides. Example 1: Save a web page. [root@linuxnix ~]# curl https://www.linuxnix.com/ >> linuxnix.html % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 206k 0 206k 0 0 29952 0 --:--:-- 0:00:07 --:--:-- 179k [root@linuxnix ~]# The above example will save the content of the web page https://www.linuxnix.com/ to a file named linuxnix.html. Example 2: Specify output file name in curl command By...
Read More