linux 基础操作(十一)测试远程主机

ping

[root@localhost ~]# ping 192.168.218.236
PING 192.168.218.236 (192.168.218.236) 56(84) bytes of data.
64 bytes from 192.168.218.236: icmp_seq=1 ttl=64 time=0.452 ms
64 bytes from 192.168.218.236: icmp_seq=2 ttl=64 time=0.360 ms
64 bytes from 192.168.218.236: icmp_seq=3 ttl=64 time=0.446 ms

telnet

[root@localhost ~]# telnet 192.168.218.236 8080
-bash: telnet: command not found
[root@localhost ~]# yum install telnet
Loaded plugins: fastestmirror, refresh-packagekit, security
[root@localhost ~]# telnet 192.168.218.236 8080
Trying 192.168.218.236...
telnet: connect to address 192.168.218.236: Connection refused

nmap

[root@localhost ~]# nmap 192.168.218.236 -p 8080
-bash: nmap: command not found
[root@localhost ~]# yum install nmap
Loaded plugins: fastestmirror, refresh-packagekit, security
[root@localhost ~]# nmap 192.168.218.236 -p 8080

Starting Nmap 5.51 ( http://nmap.org ) at 2019-11-19 10:40 CST
Nmap scan report for 192.168.218.236
Host is up (0.00039s latency).
PORT     STATE  SERVICE
8080/tcp closed http-proxy

nc

[root@localhost ~]# nmap 192.168.218.236 -p 8080
-bash: nmap: command not found
[root@localhost ~]# yum install nmap
Loaded plugins: fastestmirror, refresh-packagekit, security
[root@localhost ~]# nc -v 192.168.218.236 8080
nc: connect to 192.168.218.236 port 8080 (tcp) failed: Connection refused

wget

[root@localhost ~]# wget 192.168.218.204:9527
--2019-11-19 10:19:25--  http://192.168.218.204:9527/
Connecting to 192.168.218.204:9527... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://1.1.1.3/ac_portal/proxy.html?template=20190330210354&tabs=pwd&vlanid=0&url=http://192.168.218.204%3a9527%2f [following]
--2019-11-19 10:19:25--  http://1.1.1.3/ac_portal/proxy.html?template=20190330210354&tabs=pwd&vlanid=0&url=http://192.168.218.204%3a9527%2f
Connecting to 1.1.1.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2250 (2.2K) [text/html]
Saving to: ‘index.html.1’

100%[============================================================>] 2,250       --.-K/s   in 0s      

2019-11-19 10:19:25 (74.0 MB/s) - ‘index.html.1’ saved [2250/2250]

[root@localhost ~]# wget 192.168.218.236:8080
--2019-11-19 10:42:41--  http://192.168.218.236:8080/
Connecting to 192.168.218.236:8080... failed: Connection refused.

指定请求头的访问

[root@fastdfsdht ~]# wget https://fastdfs.qiankunpingtai.com:20000/fastdfs/download/fileWithToken?filePath=group5/M00/00/00/r349ifdsjfaCXW1EFP2voI235.mp4 --header=access_token:Tk2.0RR5eirqiwer
--2020-10-30 18:11:37--  https://fastdfs.qiankunpingtai.com:20000/fastdfs/download/fileWithToken?filePath=group1/M00/00/00/r349ifdsjfaCXW1EFP2voI235.mp4 
Resolving fastdfs.qiankunpingtai.com (fastdfs.qiankunpingtai.com)... 319.145.25.193
Connecting to fastdfs.qiankunpingtai.com(fastdfs.qiankunpingtai.com)|319.145.25.193|:20000... connected.
HTTP request sent, awaiting response... 200 
Length: unspecified [application/json]
Saving to: ‘fileWithToken?filePath=group1%2FM00%2F00%2F00%2FrBXaFF-GmsuAR1PQCXW1EFP2voI235.mp4’

    [ <=>                                                       ] 186         --.-K/s   in 0s      

2020-10-30 18:11:38 (4.19 MB/s) - ‘fileWithToken?filePath=group1%2FM00%2F00%2F00%2FrBXaFF-GmsuAR1PQCXW1EFP2voI235.mp4’ saved [186]

wget 下载 ftp 文件

wget -nH -m --ftp-user=your_username --ftp-password=your_password ftp://your_ftp_host/*

使用命令下载 ftp 上的文件
your_username : 这个是用户的账号
your_password : 这个是用户的 ftp 密码
your_ftp_host:这个是 ftp 服务器的地址
参数:
-nH:不创建以主机名命名的目录。
–cut-dirs:希望去掉原来的目录层数,从根目录开始计算。如果想完全保留 FTP 原有的目录结构,则不要加该参数。
-m:下载所有子目录并且保留目录结构。
–ftp-user:FTP 用户名
–ftp-password:FTP 密码
ftp://.../*:FTP 主机地址。最后可以跟目录名来下载指定目录。

[root@mysql-master init.d]# wget -nH -m --ftp-user=test --ftp-password=abcdefgh ftp://192.168.204.234/
--2019-12-30 16:54:39--  ftp://192.168.204.234/
           => “.listing”
Connecting to 192.168.204.234:21... connected.
Logging in as test ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD not needed.
==> PASV ... done.    ==> LIST ... done.

    [ <=>                                                                                                                                                ] 348         --.-K/s   in 0s      

2019-12-30 16:54:39 (60.8 MB/s) - “.listing” saved [348]

--2019-12-30 16:54:39--  ftp://192.168.204.234/M2M_01_31_20190702000000_20190702235959.txt
           => “M2M_01_31_20190702000000_20190702235959.txt”
==> CWD not required.
==> PASV ... done.    ==> RETR M2M_01_31_20190702000000_20190702235959.txt ... done.
Length: 83

100%[===================================================================================================================================================>] 83          --.-K/s   in 0s      

上一篇 linux 基础操作(十)设置 ip