CURL is an alternative to the wget command that works similarly to the API tools like Insomniac and Postman. It provides an interactive UI (user interface) which allows you to request multiple URLs to process and receive the requests. This command line tool enables the data exchange between a server and a device on macOS, Linux, and Windows. This command supports the different transfer protocols such as FTP, HTTPS, and SMTP using the libcURL client-side URL transfer library.
The CURL command is used to interact with APIs, downloading files, automating web series, following redirects from the terminal, and testing websites and APIs. Using this command, the users can specify the URL of a server where the data or requests should be sent. Meanwhile, it also enables setting the proxies including cookies, and adding authentication credentials while making the requests for the users. In this tutorial, we will install and use the CURL command on Rocky Linux 9.
How to Install CURL on Rocky Linux 9
CURL is not pre-installed in Rocky Linux 9. If you need this command, you can easily install it through several methods.
As you know, the CURL command doesn’t come pre-installed in Rocky Linux 9 but is available in its repositories. That’s why you can install the CURL command from its repository.
First, update the package repositories through the following command:
Now, you can install the CURL command using the following command:
This way, you can easily install CURL in a few steps. To verify whether it is installed successfully or not, you can use the following command:
The given output shows that the CURL version is 7.61.1 which indicates that it is successfully installed in your system.
How to Use CURL on Rocky Linux 9
This versatile tool is used to transfer the data through different network protocols. After installing CURL, you can start using this command. The general syntax for using the CURL command in Linux is as follows:
It provides various options to customize the output. Some of the mainly used options are as follows:
Options |
Description |
-o (filename) | It allows to specify the saved filename. |
-O (filename) | It saves the file with its original name. |
-X (method) | It specifies the HTTP method (delete, put, post, get). |
-H (header) | It adds a custom header to the request. |
-L (location) | It follows the redirects if the URL points to a different location. |
-u (user password) | It provides authentication credentials for the request. |
-F (form data) | It sends the data as a multipart form request. |
-d (data) | It sends the data in the request body. |
-I (include only header) | It displays the HTTP header. |
For example, if you want to save the file with its original name, you can run the following CURL command in the terminal:
Similarly, to display the HTTP header of the URL, use the following command:
Bonus Tip: If you run the CURL command without adding options, it prints that web page’s content in the output.
Moreover, you can explore the CURL options and understand better through the following command:
You can also access the manual page of the CURL command which provides a detailed information about this.
Conclusion
The CURL command allows the users to handle cookies, set timers, and send the data in operating systems such as Windows, macOS, and Linux. This tutorial explained how to install the CURL command on Rocky Linux 9. Along with this, we also describe here the use of the CURL command with its brief introduction. It provides many options to customize its output. You can use CURL with the help of these options. With this tutorial’s help, you can install and use the CURL command on Rocky Linux 9.