页面“什么是BOM”与“每天一命令之curl”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
(导入1个版本)
 
docker>Evan
 
第1行: 第1行:
BOM(byte-order mark),即字节顺序标记,它是插入到以UTF-8、UTF16或UTF-32编码Unicode文件开头的特殊标记,用来识别Unicode文件的编码类型。对于UTF-8来说,BOM并不是必须的,因为BOM是用来标记多字节编码文件的编码类型和字节顺序(big-endian或little- endian)。而UTF8中,每个字符的编码有多少位是通过第一个字节来表述的,而且没有big-endian和little-endian的区分,见后述。
+
=常用参数=
 +
<pre>
 +
-L, --location      Follow redirects 进行强制重定向
 +
    --location-trusted Like --location, and send auth to other hosts
 +
    --login-options <options> Server login options
 +
    --mail-auth <address> Originator address of the original email
 +
    --mail-from <address> Mail from this address
 +
    --mail-rcpt <address> Mail to this address
  
BOMs 文件头:
 
  00 00 FE FF    = UTF-32, big-endian
 
  FF FE 00 00    = UTF-32, little-endian
 
  EF BB BF      = UTF-8,
 
  FE FF          = UTF-16, big-endian
 
  FF FE          = UTF-16, little-endian
 
  
UTF-8(无BOM)和UTF-8这两个有什么区别呢?BOM是什么呀?
+
-o, --output <file> Write to file instead of stdout
 +
-o:将文件保存为命令行中指定的文件名的文件中
  
 +
-O:使用URL中默认的文件名保存文件到本地
  
 +
举个栗子
 +
curl -L linux.net/lnmp.sh -o 1.sh
 +
把lnmp.sh 下载回来 并重命令为1.sh
  
BOM: Byte Order Mark
 
UTF-8 BOM又叫UTF-8 签名,其实UTF-8 的BOM对UFT-8没有作用,是为了支援UTF-16,UTF-32才加上的BOM,BOM签名的意思就是告诉编辑器当前文件采用何种编码,方便编辑器识别,但是BOM虽然在编辑器中不显示,但是会产生输出,就像多了一个空行。
 
  
一般采用UTF-8无BOM格式即可。
+
 
  [[category:ops]]
+
指令:curl
 +
在linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具。它支持文件的上传和下载,是综合传输工具,但按传统,习惯称url为下载工具。
 +
 
 +
 
 +
语法:# curl [option] [url]
 +
 
 +
 
 +
常见参数:
 +
-A/--user-agent <string>        设置用户代理发送给服务器
 +
-b/--cookie <name=string/file>  cookie字符串或文件读取位置
 +
-c/--cookie-jar <file>          操作结束后把cookie写入到这个文件中
 +
-C/--continue-at <offset>      断点续转
 +
-D/--dump-header <file>        把header信息写入到该文件中
 +
-e/--referer                    来源网址
 +
-f/--fail                      连接失败时不显示http错误
 +
-o/--output                    把输出写到该文件中
 +
-O/--remote-name                把输出写到该文件中,保留远程文件的文件名
 +
-r/--range <range>              检索来自HTTP/1.1或FTP服务器字节范围
 +
-s/--silent                    静音模式。不输出任何东西
 +
-T/--upload-file <file>        上传文件
 +
-u/--user <user[:password]>    设置服务器的用户和密码
 +
-w/--write-out [format]        什么输出完成后
 +
-x/--proxy <host[:port]>        在给定的端口上使用HTTP代理
 +
-#/--progress-bar              用进度条显示当前的传送状态
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
用curl的内置option就好,存下http的结果,用这个option: -o
 +
 
 +
curl -o page.html http://www.yahoo.com
 +
 
 +
大写的O,这么用:这样,就可以按照服务器上的文件名,自动存在本地了
 +
curl -O http://cgi2.tky.3web.ne.jp/~zzh/screen1.JPG
 +
 
 +
 
 +
访问不到?肯定是你的proxy没有设定了。
 +
使用curl的时候,用这个option可以指定http访问所使用的proxy服务器及其端口: -x
 +
curl -x 123.45.67.89:1080 -o page.html http://www.yahoo.com
 +
 
 +
 
 +
下载
 +
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
 +
 
 +
 
 +
其它例子本身就是一个sh脚本 哈哈 写得不错
 +
https://test.docker.com/
 +
  curl -fsSL https://test.docker.com/ | bash
 +
 
 +
curl -fsSL https://test.com/lnmp.sh | bash
 +
 
 +
-f/--fail                      连接失败时不显示http错误
 +
 
 +
-s/--silent                    静音模式。不输出任何东西
 +
 
 +
-S, --show-error    Show error. With -s, make curl show errors when they occur
 +
 
 +
-L, --location      Follow redirects (H)
 +
 
 +
or
 +
wget http://xxx/xxx.sh -O- | bash
 +
 
 +
</pre>
 +
 
 +
=指定ip访问url=
 +
<pre>指定ip访问url
 +
curl -H 'Host:a.com' http://10.12.20.21
 +
 
 +
</pre>
 +
 
 +
=see also=
 +
https://www.cnblogs.com/gbyukg/p/3326825.html
 +
 
 +
http://www.21andy.com/new/20080602/1154.html
 +
http://doiido.blog.51cto.com/5503054/1564631
 +
https://www-31.ibm.com/support/techdocs/cn/faqhtmlfaq/2311073I23001.htm
 +
 
 +
[[category:shell]][[category:ops]][[category:linux]]

2019年8月19日 (一) 06:58的版本

常用参数

 -L, --location      Follow redirects 进行强制重定向
     --location-trusted Like --location, and send auth to other hosts
     --login-options <options> Server login options
     --mail-auth <address> Originator address of the original email
     --mail-from <address> Mail from this address
     --mail-rcpt <address> Mail to this address


-o, --output <file> Write to file instead of stdout
-o:将文件保存为命令行中指定的文件名的文件中

-O:使用URL中默认的文件名保存文件到本地

举个栗子
curl -L linux.net/lnmp.sh -o 1.sh
把lnmp.sh 下载回来 并重命令为1.sh 



指令:curl
在linux中curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具。它支持文件的上传和下载,是综合传输工具,但按传统,习惯称url为下载工具。


语法:# curl [option] [url]


常见参数:
-A/--user-agent <string>        设置用户代理发送给服务器
-b/--cookie <name=string/file>  cookie字符串或文件读取位置
-c/--cookie-jar <file>          操作结束后把cookie写入到这个文件中
-C/--continue-at <offset>       断点续转
-D/--dump-header <file>         把header信息写入到该文件中
-e/--referer                    来源网址
-f/--fail                       连接失败时不显示http错误
-o/--output                     把输出写到该文件中
-O/--remote-name                把输出写到该文件中,保留远程文件的文件名
-r/--range <range>              检索来自HTTP/1.1或FTP服务器字节范围
-s/--silent                     静音模式。不输出任何东西
-T/--upload-file <file>         上传文件
-u/--user <user[:password]>     设置服务器的用户和密码
-w/--write-out [format]         什么输出完成后
-x/--proxy <host[:port]>        在给定的端口上使用HTTP代理
-#/--progress-bar               用进度条显示当前的传送状态








用curl的内置option就好,存下http的结果,用这个option: -o

 curl -o page.html http://www.yahoo.com

大写的O,这么用:这样,就可以按照服务器上的文件名,自动存在本地了
 curl -O http://cgi2.tky.3web.ne.jp/~zzh/screen1.JPG


访问不到?肯定是你的proxy没有设定了。
使用curl的时候,用这个option可以指定http访问所使用的proxy服务器及其端口: -x
 curl -x 123.45.67.89:1080 -o page.html http://www.yahoo.com


下载 
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py


其它例子本身就是一个sh脚本 哈哈 写得不错 
https://test.docker.com/ 
 curl -fsSL https://test.docker.com/ | bash

curl -fsSL https://test.com/lnmp.sh | bash

-f/--fail                       连接失败时不显示http错误

-s/--silent                     静音模式。不输出任何东西

-S, --show-error    Show error. With -s, make curl show errors when they occur

-L, --location      Follow redirects (H)

or 
wget http://xxx/xxx.sh -O- | bash

指定ip访问url

指定ip访问url
curl -H 'Host:a.com' http://10.12.20.21

see also

https://www.cnblogs.com/gbyukg/p/3326825.html

http://www.21andy.com/new/20080602/1154.html http://doiido.blog.51cto.com/5503054/1564631 https://www-31.ibm.com/support/techdocs/cn/faqhtmlfaq/2311073I23001.htm