参考链接:https://blog.csdn.net/msdnchina/article/details/90731983
注意:
执行curl命令的os的os版本是rhel7.5
192.168.80.8的os版本是rhel8.0
[root@dbserver ~]# curl -N -k -u root:aaaaaa -O "scp://192.168.80.8/root/i-am-from-rhel8.txt"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
[root@dbserver ~]# echo $? ----->>>>此时192.168.80.8/root/i-am-from-rhel8.txt是0k,curl命令执行成功(返回0),但是没有传输过来i-am-from-rhel8.txt文件,见下ls
0
[root@dbserver ~]# pwd
/root
[root@dbserver ~]# ls
anaconda-ks.cfg Desktop Documents Downloads Music Pictures pip-18.0 pip-18.0.tar postgresql-10.4.tar.gz Public Templates Videos
=================随意添加几个字符到192.168.80.8/root/i-am-from-rhel8.txt中,保存退出======================
[root@dbserver ~]# curl -N -k -u root:aaaaaa -O "scp://192.168.80.8/root/i-am-from-rhel8.txt"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4 100 4 0 0 10 0 --:--:-- --:--:-- --:--:-- 10
100 4 100 4 0 0 10 0 --:--:-- --:--:-- --:--:-- 10
[root@dbserver ~]# ll ----->>>>此时192.168.80.8/root/i-am-from-rhel8.txt是4k,curl命令执行成功(返回0), 传输过来i-am-from-rhel8.txt文件,见本ll
total 30588
-rw-------. 1 root root 1781 May 22 2018 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 Nov 4 2018 Desktop
drwxr-xr-x. 2 root root 6 Nov 4 2018 Documents
drwxr-xr-x. 2 root root 6 Nov 4 2018 Downloads
-rw-r--r--. 1 root root 4 Jun 1 14:25 i-am-from-rhel8.txt
drwxr-xr-x. 2 root root 6 Nov 4 2018 Music
drwxr-xr-x. 2 root root 6 Nov 4 2018 Pictures
drwxr-xr-x. 6 501 games 216 Sep 26 2018 pip-18.0
-rw-r--r--. 1 root root 4659200 Sep 26 2018 pip-18.0.tar
-rw-r--r--. 1 root root 26652442 May 23 2018 postgresql-10.4.tar.gz
drwxr-xr-x. 2 root root 6 Nov 4 2018 Public
drwxr-xr-x. 2 root root 6 Nov 4 2018 Templates
drwxr-xr-x. 2 root root 6 Nov 4 2018 Videos
[root@dbserver ~]# curl -V
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.28.4 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets
[root@dbserver ~]# cat i-am-from-rhel8.txt
abs
[root@dbserver ~]# curl -sN -k -u root:aaaaaa -O "scp://192.168.80.8/root/i-am-from-rhel8.txt"
------>>> -s代表静默模式。