How to Upload File From Linux Command Line

The command roll function is to ease file transference betwixt devices through protocols DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET or TFTP.

If y'all know your file remote location you can download it with a single command guild. Whorl supports authentication and encryption. This tutorial will explain how to download files using ringlet, how to upload files using cURL, how to resume interrupted downloads or to utilize a proxy when downloading files amidst other tips.

If curl isn't installed in your Debian/Ubuntu Linux distribution type:

For CentOS and Fedora run:

Downloading files using cURL:

Once installed nosotros can start using to download a file from any website similar wget. Type:

# gyre -O http://ftp.united states.debian.org/debian/pool/main/n/nano/nano_2.7.4-1_amd64.deb

% Full % Received % Xferd  Average Speed   Time     Time    Time  Electric current
Dload  Upload   Total   Spent   Left  Speed
100     473k 100  473k0 0   293k0 0:00:01 0:00:01 --:--:--  293k

We tin apply ringlet to download multiple files from multiple sources with a control:

# scroll -O http://ftp.us.debian.org/debian/pool/main/north/nano/nano_2.7.iv-1_amd64.deb-
http://ftp.us.debian.org/debian/pool/main/southward/snort/snort_2.9.vii.0-5_amd64.deb -O
https://www.snort.org/downloads/snort/snort-2.9.13-one.f29.x86_64.rpm

% Full % Received % Xferd  Average Speed   Fourth dimension     Time    Time  Electric current
Dload  Upload   Full   Spent   Left  Speed
100  473k 100  473k00  271k0 0:00:01 0:00:01 --:--:--  271k
100  825k 100  825k 00  1429k 0 --:--:-- --:--:-- --:--:-- 1429k
100 474 0 474 0 0740 --:--:-- 0:00:06 --:--:-- 124
root@LinuxHint:/home/linuxhint#

If when using Curl we don't desire to store the files in the working directory, utilise a low case -o parameter to specify the directory, you lot can as well alter the file'southward name using this parameter:

# ringlet -o /home/linuxhint/w3af/Namewewant.deb http://ftp.usa.debian.org/debian/puddle/
main/north/nano/nano_2.7.four-ane_amd64.deb

% Total % Received % Xferd  Average Speed   Time     Fourth dimension    Time  Current
Dload  Upload   Total   Spent   Left  Speed
100  473k 100  473k 0 0   313k0 0:00:01 0:00:01 --:--:--  313k


Additionally to the "-O" parameter, we tin can resume interrupted downloads using the "-C -" parameter.

Yous can endeavour downloading nano or whatsoever file and interrupt the download pressing ctrl+c:

# ringlet -O http://ftp.us.debian.org/debian/pool/principal/northward/nano/nano_2.seven.four-1_amd64.deb

% Total % Received % Xferd  Average Speed Fourth dimension  Fourth dimension  Fourth dimension  Current
Dload  Upload   Full   Spent   Left  Speed
three  473k3 15828 0 0 244790 0:00:19 --:--:--0:00:19 24463^C

And so resume the interrupted download using " curl -C – -O <http://destination/file> ":

# curl -C - -O  http://ftp.u.s.a..debian.org/debian/pool/main/n/nano/nano_2.vii.4-1_amd64.deb
** Resuming transfer from byte position 151552
% Total % Received % Xferd  Average Speed   Fourth dimension     Time    Time  Curren
Dload  Upload   Total   Spent   Left  Speed
100  325k 100  325k 0 0   221k 0 0:00:01 0:00:01 --:--:--  221k

cURL likewise supports using proxy and authentication, to download a file using a proxy nosotros need the -ten parameter:

# curl -ten 138.68.twoscore.138:8080 -O  http://ftp.us.debian.org/debian/pool/main/n/nano/
nano_2.seven.iv-1_amd64.deb

% Full % Received % Xferd  Average Speed  Fourth dimension  Time Time Current
Dload  Upload   Total   Spent   Left  Speed
100  473k 100  473k 0 0   262k 0 0:00:01 0:00:01 --:--:--  261k

Note: yous can find proxy servers for testing at https://gratuitous-proxy-list.net/

Uploading files using cURL:

To upload a file using coil nosotros need to apply the –upload-file parameter.

curl --upload-file < file > <http://server>

You tin test this control for uploading using https://transfer.sh/ complimentary service to share files from the command line.

#  whorl --upload-file nano_2.seven.iv-1_amd64.deb https://transfer.sh/nano.deb
# curl -O https://transfer.sh/hOlbR/nano.deb
% Full% Received % Xferd  Average Speed   Time  Time Time Current
Dload  Upload   Full   Spent   Left  Speed
100  473k 100  473k00   140k0 0:00:03 0:00:03 --:--:--  140k

Nosotros just uploaded nano using curl, and downloaded it using cURL through the url provided by https://transfer.sh.

Uploading to an FTP server with authentication:

# curl -u <username>:<password> -T nano_2.seven.4-1_amd64.deb ftp://ivanney.com

% Total% Received % Xferd  Average Speed   Time  Time Time Current
Dload  Upload   Total   Spent   Left  Speed
100  473k 00 100  473k0 107k 0:00:04 0:00:04 --:--:--  107k

Notation: image edited to hide the password.

Equally you lot see whorl is a great tool to share files from the command line and information technology supports many protocols.

I hope yous found this tutorial useful to get your data fully removed, should you take any research contact us opening a ticket support at LinuxHint Support. Go along post-obit LinuxHint for more tips and updates on Linux.

Well-nigh the author

David Adams is a System Admin and author that is focused on open source technologies, security software, and reckoner systems.

hagberghertake.blogspot.com

Source: https://linuxhint.com/curl_command_linux/

0 Response to "How to Upload File From Linux Command Line"

Publicar un comentario

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel