一:浏览网页和下载
curl和wget和elinks工具
1:curl工具
1:选项
-o | 将要浏览的网页另存为 |
-O | 将浏览的网页下载 |
-i | 查看服务信息以及状态码 |
-x | 远程代理,要加上端口号,服务的安全性,隐藏了原来的端口号 |
2:案例
1)查看服务的信息以及状态码
状态码:200(能够访问),301表示网址重定向(就是访问这个网页的时候,就会去另外的一个网页),404(资源不存在),403(权限被拒绝)
一般来说,权限被拒绝,应该是selinux或者防火墙的权限,文件的权限这几个方面
[root@server /]# curl -i www.baidu.com | head -20 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2381 100 2381 0 0 11502 0 --:--:-- --:--:-- --:--:-- 11502 HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform Connection: keep-alive Content-Length: 2381 Content-Type: text/html Date: Mon, 05 Feb 2024 13:57:02 GMT Etag: "588604dc-94d" Last-Modified: Mon, 23 Jan 2017 13:27:56 GMT Pragma: no-cache Server: bfe/1.0.8.18 Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/ #可以看到这个服务跑在哪个服务上面,也还可以看到状态码200相关的信息
2)代理服务器的操作
3)下载的操作
[root@client opt]# curl -O www.baidu.com/index.html % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2381 100 2381 0 0 8503 0 --:--:-- --:--:-- --:--:-- 8503 [root@client opt]# ls index.html [root@client opt]# curl -o /opt/html www.baidu.com/index.html % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2381 100 2381 0 0 8689 0 --:--:-- --:--:-- --:--:-- 8689 [root@client opt]# ls html index.html [root@client opt]# #小写的o就是另存为,另存为写在前头
3:网页访问时的日志文件
/var/log/httpd这个就是存放浏览过的相关信息,使用什么命令,或者得到了什么结果
[root@server httpd]# pwd /var/log/httpd [root@server httpd]# cat access_log 192.168.20.10 - - [05/Feb/2024:10:36:23 +0800] "GET / HTTP/1.1" 200 2 "-" "curl/7.76.1" 192.168.20.10 - - [05/Feb/2024:10:36:52 +0800] "GET /index.html HTTP/1.1" 200 2 "-" "curl/7.76.1" 192.168.20.10 - - [05/Feb/2024:10:37:36 +0800] "GET /index.html HTTP/1.1" 200 2 "-" "Wget/1.21.1"
2:wget工具
wget就是下载的工具,非常的便利,专门下载文件的
1:选项
-O(大写的) | 另存为 |
-b | 放在后台执行 |
-P | 指定下载的路径,路径不存在,就创建路径,不能改名 |
--spider | 测试下载,检测是否存在,有的话则表示可以下载 |
2:案例
1)下载
[root@server opt]# wget -O /opt/qq www.baidu.com/index.html --2024-02-05 22:16:48-- http://www.baidu.com/index.html Resolving www.baidu.com (www.baidu.com)... 36.155.132.76, 36.155.132.3, 2409:8c20:6:1135:0:ff:b027:210c, ... Connecting to www.baidu.com (www.baidu.com)|36.155.132.76|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2381 (2.3K) [text/html] Saving to: ‘/opt/qq’ /opt/qq 100%[=================================================>] 2.33K --.-KB/s in 0.001s 2024-02-05 22:16:48 (1.95 MB/s) - ‘/opt/qq’ saved [2381/2381] [root@server opt]# ls qq [root@server opt]#
2)-P的使用
[root@server opt]# wget -P /opt/22 www.baidu.com/index.html --2024-02-05 22:19:45-- http://www.baidu.com/index.html Resolving www.baidu.com (www.baidu.com)... 36.155.132.3, 36.155.132.76, 2409:8c20:6:1d55:0:ff:b09c:7d77, ... Connecting to www.baidu.com (www.baidu.com)|36.155.132.3|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2381 (2.3K) [text/html] Saving to: ‘/opt/22/index.html’ index.html 100%[=================================================>] 2.33K --.-KB/s in 0.05s 2024-02-05 22:19:46 (44.0 KB/s) - ‘/opt/22/index.html’ saved [2381/2381] [root@server opt]# ls 22 qq [root@server opt]# cd 22 [root@server 22]# ls index.html [root@server 22]# vim index.html [root@server 22]# pwd /opt/22 #会创建一个目录出来用于存放下载的文件
3)测试下载
[root@server 22]# wget --spider www.baidu.com/index.html Spider mode enabled. Check if remote file exists. --2024-02-05 22:22:32-- http://www.baidu.com/index.html Resolving www.baidu.com (www.baidu.com)... 36.155.132.76, 36.155.132.3, 2409:8c20:6:1d55:0:ff:b09c:7d77, ... Connecting to www.baidu.com (www.baidu.com)|36.155.132.76|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2381 (2.3K) [text/html] Remote file exists and could contain further links, but recursion is disabled -- not retrieving. [root@server 22]#
二:远程访问linux系统
通过ssh远程访问linux系统
1:ssh协议
ssh协议是一种加密的协议,用于系统之间的通信和远程登陆的,有openssh这个包提供支持ssh协议的实现
提供一下工具,ssh,sshd,scp,sftp,ssh-keygen,ssh-copy-id这几个工具
标签:baidu,opt,www,--,RHCE,第五,html,com,客户端 From: https://www.cnblogs.com/qm77/p/18008880