Curl download/upload FTP files

Curl is a command-line tool for transferring data between a local computer and a remote server

2 min read
By myfreax
Curl download/upload FTP files
Curl download/upload FTP files

Curl is a command-line tool for transferring data between a local computer and a remote server.

When using curl you can download or upload data using protocols such as HTTP, HTTPS, SCP , SFTP and FTP .

The Curl command is pre-installed on most Linux distributions. To check if your Linux distribution has Curl installed, press the shortcut key CTRL+ALT+Tto open Terminal, type curl and press Enter.

If curl is installed, the system will print curl: try 'curl --help' or 'curl --manual' for more information.

Install Curl

Otherwise, the terminal prints the message curl command not found. If you don't have Curl installed, you can install it using your distribution's package manager.

If your computer is running a Debian-based Linux distribution such as Ubuntu, Linux Mint, etc. Please run sudo apt install curl to install Curl.

If your computer is running a Redhat-based Linux distribution, such as CentOS, Fedora, etc. Please run sudo yum install curl to install Curl.

sudo yum install curl
sudo apt install curl

Download/upload FTP files

In addition to the HTTP protocol, the Curl command also supports FTP protocol file download and upload, and lists files on the FTP server.

If you need to access a protected FTP server using the curl command, use the -uoptions of the Curl command and specify the username and password.

The -T options of the Curl command allow you to upload files to an FTP server, followed by the file you want to upload, and you can also specify the absolute path of the file.

curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/ #list file

curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/file.tar.gz #download file

curl -T newfile.tar.gz -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/ #upload file
Linux Curl Command Detailed Tutorial | myfreax
curl is a command-line tool for transferring data between a local computer and a remote server

Related Articles