"$d_SysMaint""Linux/download via command line [curl, wget].txt www.BillHowell.ca 07Jul2020 initial see "$d_bin""download via command line.ndf" "$d_bin""wget download.sh" - download files ******** 08Sep2020 search "Linux curl and how do I upload a file?" +-----+ https://www.lynxbee.com/how-to-upload-file-image-using-curl-command-line/ Lets say, we want to upload an picture available at “/home/myuser/mypicture.jpg” to server at “https://www.YOUR_SERVER_URL/upload” which uses file input form with parameter name as “image”, then we will have to use below command, $ curl -k -X POST -F 'image=@/home/myuser/mypicture.jpg' -v https://www.YOUR_SERVER_URL/upload/ here, above -v option is just for debugging purpose to understand how it goes with more verbose messages, you can avoid using it in production. -F, --form (HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC 2388. This enables uploading of binary files etc. To force the 'content' part to be a file, prefix the filename with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file. Example: to send an image to a server, where 'profile' is the name of the form-field to which portrait.jpg will be the input: >> no idea what this means -k, --insecure (TLS) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, --insecure is used. >> don't want this!!! -o, --output Write output to instead of stdout. If you are using {} or [] to fetch multiple documents, you can use '#' followed by a number in the specifier. That variable will be replaced with the current string for the URL being fetched. Like in: curl http://{one,two}.example.com -o "file_#1.txt" or use several variables like: curl http://{site,host}.host[1-5].com -o "#1_#2" >> only for download? -T, --upload-file This transfers the specified local file to the remote URL. If there is no file part in the specified URL, curl will append the local file name. NOTE that you must use a trailing / on the last directory to really prove to Curl that there is no file name or curl will think that your last directory name is the remote file name to use. That will most likely cause the upload operation to fail. If this is used on an HTTP(S) server, the PUT command will be used. >> only for upload? -v, --verbose Makes curl verbose during the operation. Useful for debugging and seeing what's going on "under the hood". A line starting with '>' means "header data" sent by curl, '<' means "header data" received by curl that is hidden in normal cases, and a line starting with '*' means additional info provided by curl. >> don't want this!!! -X, --request (HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more. Normally you don't need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options. >> don't want this!!! +-----+ https://www.techrepublic.com/article/how-to-use-the-curl-command-for-uploading-and-downloading-files-without-user-interaction/ Jack Wallen in Networking on May 24, 2018, 8:47 AM PST Say you have a file you want to download from a site. Curl can handle this like so: curl http://SERVER_ADDRESS/FILENAME -o FILENAME If that file is password protected, curl can handle that like so: curl -u USERNAME:PASSWORD http://SERVER_ADDRESS -o FILENAME curl ftp://SERVER_ADDRESS/FILENAME -user USERNAME:PASSWORD -o FILENAME To upload a file to an FTP server, the command would be: curl -T FILENAME SERVER_ADDRESS -user USERNAME:PASSWORD *********** 07Jul2020 https://vitux.com/how-to-download-a-file-on-ubuntu-linux-using-the-command-line/ How to Download a File on Ubuntu Linux using the Command Line +-----+ Download files using Curl Curl can be used to transfer data over a number of protocols. It supports many protocols including HTTP, HTTPS, FTP, TFTP, TELNET, SCP, etc. using Curl, you can download any remote files. It supports pause and resumes function as well. Download and save the file with a different name If you want to download the file and save it in a different name than the name of the file in the remote server, use -o (lower-case o) as shown below. This is helpful when the remote URL doesn’t contain the file name in the URL as shown in the example below. $ curl –o [filename] [URL] [filename] is the new name of the output file. +-----+ Download files using Wget Using wget, you can download files and contents from Web and FTP servers. Wget is a combination of www and the get. It supports protocols like FTP, SFTP, HTTP, and HTTPS. Also it supports recursive download feature. This feature is very useful if you want to download an entire website for offline viewing or for generating a backup for static website. In addition, you can use it to retrieve content and files from various web servers. Download files with a different name If you want to download and save the file with a different name than the name of the original remote file, use -O (upper-case O) as shown below. This is helpful especially when you are downloading a webpage that automatically get saved with the name “index.html”. To download file with a different name, enter the command in the following syntax: $ wget -O [filename] [URL] # enddoc