The Linux operating system permits us different configurations to extend the job options. Anyone can accomplish this by introducing and installing additional commands which altogether improve the distribution functionality. One of these is the ‘curl’ command, and in this article, we will talk about this command in detail.
What is a curl?
Before getting into this command, you should know what curl is. A curl is a command-line tool that is used to exchange or transfer data from or to a server by utilizing one from the list of these protocols (FILE, DICT, LDAP, TFTP, TELNET, HTTP, SMTP, FTP, SFTP, IMAP, SCP, POP3, GOPHER, SMBS, HTTP, RTSP, HTTPS, RTMPS, IMAP, MQTT, LDAPS, etc). Curl uses different libraries to transfer information by providing several options for maintaining data security. This command is outlined to work without any interaction from the user or client-side, and it can also transfer multiple files simultaneously and effortlessly. It is considered popular globally because it can turn the command line or script into a container to carry out the data.
Why do we use the curl command?
As a Linux user, you will frequently come over curl being utilized for downloading different applications or software from websites or web repositories. Curl is much more capable than that. It allows a Linux user to do more complex operations than essentially downloading files like FTP transfers, authentication, confirmation, proxies management, connections of SSL, demands of HTTP, and much more. Some of its extraordinary features are given below:
- It is compatible with various configuration files
- It also supports SSL, cookies, and forms
- Multiple transfers are possible by using a single command
- It includes download time details, progress bar, and speed limitations
- Curl provides support for IPv6.
That’s the approximate information you should know before Installing and using the ‘curl’ command. Now let’s begin the Installation process of curl on Ubuntu 20.04.
Installation of curl on Ubuntu 20.04:
Note: To follow the installation, make sure that you are a ‘superuser’ or ‘root’ as the superuser provides unrestricted access to all the commands, files, resources, and directories.
Step 1: First of all, Open up the terminal by searching it manually in activities, or you can also press ‘CTRL+ALT+T’ to view the terminal window.
Step 2: Next step is to update the package lists to upgrade the packages.
$ sudo apt update
Step 3: Install the ‘curl’ on your Linux system by typing the following command.
$ sudo install curl
Enter ‘y’ to permit the Installation process to move forward.
Step 4: In this step, write-out the curl command in your terminal and you will get the following output.
$ curl
Step 5: You can also check the version of curl installed on your Ubuntu 20.04.
$ curl --version
The output will let you know the version number, release date, and protocols supported by this version.
How to use the curl command in Ubuntu 20.04
In this section, we will discuss some of the ways in which you can utilize this ‘curl’ command for various purposes.
1. Download a File
To download any file, use the curl command with -o or -O. This file will have the same name as it has in its web repository. The downloaded file will be stored in the present working directory.
$ curl -o linux.tar.xzhttps://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
2. Access a Header of a file
You can also access a file’s header by using the ‘curl’ command with the -I parameter.
$ curl -I http://www.technowikis.com
It will result in the following output.
3. Downloading multiple files
A Linux User can also download multiple files by utilizing the curl command in your Ubuntu 20.04. Use the command given below to test this feature.
$ curl https://gemmei.ftp.acc.umu.se/debian-cd/current/amd64/iso-dvd/debian-10.0.0-amd64-DVD-1.iso-o debian.iso
And there is a lot more about the ‘curl‘ command and its uses like storing and sending the website cookies, modifying name resolution, download URLs from a file, use a proxy with or without the confirmation, and many more. You can explore it further for your knowledge.
Conclusion:
In this article, we have discussed the curl command, its features, and its uses. Furthermore, we have also shared the Installation method step by step. Some of the ways are also depicted in this article through which you can also use the ‘curl’ command in your Ubuntu 20.04 .
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY