第十章 文件上传或者下载命令

一、rz       #将本地的文件上传到Linux操作系统

         #不能上传目录,需要将目录打成一个压缩包进行上传 只能上传 4G以下的文件

[root@jindada ~]# yum install lrzsz -y

选项:

-E         #当上传的文件已经存在时,系统会进行重命名 会在原来的文件名称后面加上.数字 从0开始


#执行命令,会跳出一个Windows界面的窗口,选择你要上传的文件

[root@jindada ~]# rz

[root@jindada ~]# ll
total 16
-rw-r--r--. 1 root root 13140 Jul 7 12:23 day03.md


[root@jindada ~]# rz -E

[root@jindada ~]# ll
total 32
-rw-r--r--. 1 root root 13140 Jul 7 12:23 day03.md
-rw-r--r--. 1 root root 13140 Jul 7 12:23 day03.md.0


2. sz        #下载命令

[root@sh-jindada ~]# sz /etc/passwd       #选择你要下载的文件

 

二、wget

[root@jindada ~]# yum install -y wget    #联网下载软件包


选项:

-O        #指定下载的路径和名称

-q       #静默输出

--limit-rate=10k      #限制下载的速率 k ===KB m == MB

[root@jindada ~]# wget http://www.baidu.com
--2020-07-10 11:57:50-- http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 112.80.248.75, 112.80.248.76
Connecting to www.baidu.com (www.baidu.com)|112.80.248.75|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘index.html’

100%[===============================================================================>] 2,381 --.-K/s in 0.008s

2020-07-10 11:57:51 (290 KB/s) - ‘index.html’ saved [2381/2381]

[root@jindada ~]# wget http://nginx.org/download/nginx-1.18.0.tar.gz
--2020-07-10 12:00:16-- http://nginx.org/download/nginx-1.18.0.tar.gz
Resolving nginx.org (nginx.org)... 95.211.80.227, 62.210.92.35, 2001:1af8:4060:a004:21::e3
Connecting to nginx.org (nginx.org)|95.211.80.227|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1039530 (1015K) [application/octet-stream]
Saving to: ‘nginx-1.18.0.tar.gz’

100%[===============================================================================>] 1,039,530 282KB/s in 3.6s

2020-07-10 12:00:20 (282 KB/s) - ‘nginx-1.18.0.tar.gz’ saved [1039530/1039530]

[root@jindada ~]# ll
total 1020
-rw-r--r--. 1 root root 2381 Jul 10 11:57 index.html
-rw-r--r--. 1 root root 1039530 Apr 21 22:33 nginx-1.18.0.tar.gz


[root@jindada ~]# wget -O /opt/nginx.tar.gz http://nginx.org/download/nginx-1.18.0.tar.gz
--2020-07-10 12:01:41-- http://nginx.org/download/nginx-1.18.0.tar.gz
Resolving nginx.org (nginx.org)... 62.210.92.35, 95.211.80.227, 2001:1af8:4060:a004:21::e3
Connecting to nginx.org (nginx.org)|62.210.92.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1039530 (1015K) [application/octet-stream]
Saving to: ‘/opt/nginx.tar.gz’

100%[===============================================================================>] 1,039,530 272KB/s in 3.7s

2020-07-10 12:01:46 (272 KB/s) - ‘/opt/nginx.tar.gz’ saved [1039530/1039530]

[root@jindada ~]# ll /opt/
total 1016
-rw-r--r--. 1 root root 0 Jul 10 10:32 hostname
-rw-r--r--. 1 root root 0 Jul 10 10:32 hostnamectl
drwxr-xr-x. 2 root root 6 Jul 10 10:39 HOSTNAMECTL
-rw-r--r--. 1 root root 1039530 Apr 21 22:33 nginx.tar.gz


[root@jindada ~]# wget -q http://nginx.org/download/nginx-1.19.1.tar.gz
[root@jindada ~]# ll
total 2100
-rw-r--r--. 1 root root 41240 Mar 23 00:20 032220_1620_Zabbix1.png
-rw-r--r--. 1 root root 9810 Jul 8 00:06 download.html
-rw-r--r--. 1 root root 2381 Jul 10 11:57 index.html
-rw-r--r--. 1 root root 1039530 Apr 21 22:33 nginx-1.18.0.tar.gz
-rw-r--r--. 1 root root 1047223 Jul 7 23:59 nginx-1.19.1.tar.gz

 

[root@jindada ~]# wget --limit-rate=10k http://nginx.org/download/nginx-1.18.0.tar.gz ^C
[root@jindada ~]# rm -rf ./*
[root@jindada ~]# wget --limit-rate=10k http://nginx.org/download/nginx-1.18.0.tar.gz
--2020-07-10 12:11:13-- http://nginx.org/download/nginx-1.18.0.tar.gz
Resolving nginx.org (nginx.org)... 62.210.92.35, 95.211.80.227, 2001:1af8:4060:a004:21::e3
Connecting to nginx.org (nginx.org)|62.210.92.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1039530 (1015K) [application/octet-stream]
Saving to: ‘nginx-1.18.0.tar.gz’

32% [========================> ] 335,872 10.0KB/s eta 70s

 

三、curl       #通过url规则进行文件传输工具

          #测试网站使用的命令


选项:

-o          #将访问的数据内容写入到指定的文件中

-s          #静默输出

[root@jindada ~]# curl -o ./baidu.html www.baidu.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2381 100 2381 0 0 311 0 0:00:07 0:00:07 --:--:-- 657
[root@jindada ~]# ll
total 1356
-rw-r--r--. 1 root root 2381 Jul 10 12:15 baidu.html


[root@jindada ~]# curl -s -o ./nginx.tar.gz http://nginx.org/download/nginx-1.18.0.tar.gz

 

你可能感兴趣的:(第十章 文件上传或者下载命令)