Linux Curl Command detailed

Source: Internet
Author: User
Tags curl

Linux curl is a file transfer tool that works under the command line using URL rules. It supports file uploads and downloads, so it is a comprehensive transfer tool, but traditionally, the URL is used as a download tool.


1, crawl the page content into a file


[Email protected] mytest]# Curl-o home.html http://blog.51yip.com


[[email protected] mytest]# Curl-o home.html http://blog.51yip.com2, with-O (uppercase), the following URL to specific to a file, or can't catch it. We can also use the regular to grab things.


[Email protected] mytest]# Curl-o http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg

[Email protected] mytest]# Curl-o http://blog.51yip.com/wp-content/uploads/2010/[0-9][0-9]/aaaaa.jpg


[Email protected] mytest]# Curl-o http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg

[Email protected] mytest]# Curl-o http://blog.51yip.com/wp-content/uploads/2010/[0-9][0-9]/ AAAAA.JPG3, simulating form information, simulating login, saving cookie information


[Email protected] mytest]# curl-c/cookie_c.txt-f log=aaaa-f pwd=****** http://blog.51yip.com/wp-login.php


[Email protected] mytest]# curl-c/cookie_c.txt-f log=aaaa-f pwd=****** http://blog.51yip.com/ WP-LOGIN.PHP4, simulating form information, simulating login, saving header information


[Email protected] mytest]# curl-d/cookie_d.txt-f log=aaaa-f pwd=****** http://blog.51yip.com/wp-login.php


[Email protected] mytest]# curl-d/cookie_d.txt-f log=aaaa-f pwd=****** http://blog.51yip.com/wp-login.php-c (lowercase) The resulting cookie is not the same as the cookie in-D.


5, use cookie file


[Email protected] mytest]# curl-b/cookie_c.txt http://blog.51yip.com/wp-admin


[[email protected] mytest]# curl-b./cookie_c.txt http://blog.51yip.com/wp-admin6, breakpoint continuation,-C (uppercase)


[Email protected] mytest]# curl-c-o http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg


[Email protected] mytest]# curl-c-o http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg7, transfer data, It is best to use the login page test, because after you pass the value of the past, curl back to grab the data, you can see your value has no success


[Email protected] mytest]# curl-d log=aaaa http://blog.51yip.com/wp-login.php


[[email protected] mytest]# curl-d log=aaaa http://blog.51yip.com/wp-login.php8, display crawl errors, the following example, it is clear that.


[Email protected] mytest]# curl-f HTTP://BLOG.51YIP.COM/ASDF

Curl: () The requested URL returned error:404

[Email protected] mytest]# Curl HTTP://BLOG.51YIP.COM/ASDF

。。。。。。。。。。。。


[Email protected] mytest]# curl-f HTTP://BLOG.51YIP.COM/ASDF

Curl: () The requested URL returned error:404

[Email protected] mytest]# Curl HTTP://BLOG.51YIP.COM/ASDF


。。。。。。。。。。。。 9, forged source address, some website will judge, request source address.


[Email protected] mytest]# curl-e http://localhost http://blog.51yip.com/wp-login.php


[Email protected] mytest]# curl-e http://localhost http://blog.51yip.com/ WP-LOGIN.PHP10, when we often use curl to engage in people's things, people will put your IP to shield off, this time, we can use the agent


[Email protected] mytest]# curl-x 24.10.28.84:32779-o home.html http://blog.51yip.com


[[email protected] mytest]# curl-x 24.10.28.84:32779-o home.html Http://blog.51yip.com11, than the larger stuff we can download in sections


[Email protected] mytest]# curl-r 0-100-o img.part1 http://blog.51yip.com/wp-

Content/uploads/2010/09/compare_varnish.jpg

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

101 101 0 0 0--:--:----:---:----:--:--0

[Email protected] mytest]# curl-r 100-200-o img.part2 http://blog.51yip.com/wp-

Content/uploads/2010/09/compare_varnish.jpg

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

100 101 100 101 0 0 57 0 0:00:01 0:00:01--:--:--0

[Email protected] mytest]# curl-r 200--o img.part3 http://blog.51yip.com/wp-

Content/uploads/2010/09/compare_varnish.jpg

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

104k 104k 0 0 52793 0 0:00:02 0:00:02--:--:--88961

[[email protected] mytest]# ls |grep part | Xargs Du-sh

4.0K One.part1

112K Three.part3

4.0K Two.part2


[Email protected] mytest]# curl-r 0-100-o img.part1 http://blog.51yip.com/wp-


Content/uploads/2010/09/compare_varnish.jpg

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

101 101 0 0 0--:--:----:---:----:--:--0

[Email protected] mytest]# curl-r 100-200-o img.part2 http://blog.51yip.com/wp-


Content/uploads/2010/09/compare_varnish.jpg

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

100 101 100 101 0 0 57 0 0:00:01 0:00:01--:--:--0

[Email protected] mytest]# curl-r 200--o img.part3 http://blog.51yip.com/wp-


Content/uploads/2010/09/compare_varnish.jpg

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

104k 104k 0 0 52793 0 0:00:02 0:00:02--:--:--88961

[[email protected] mytest]# ls |grep part | Xargs Du-sh

4.0K One.part1

112K Three.part3

4.0K Two.part2 when used, put them cat a bit OK, cat img.part* >img.jpg


12, download progress information is not displayed


[Email protected] mytest]# curl-s-o aaa.jpg http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg


[Email protected] mytest]# curl-s-o aaa.jpg http://blog.51yip.com/wp-content/uploads/2010/09/compare_ VARNISH.JPG13, show download progress bar


[Email protected] mytest]# Curl-#-O http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg

######################################################################## 100%


[Email protected] mytest]# Curl-#-O http://blog.51yip.com/wp-content/uploads/2010/09/compare_varnish.jpg

######################################################################## 100.0%14, download files via FTP


[[email protected] ~]$ curl-u Username: password-o http://blog.51yip.com/demo/curtain/bbstudy_files/style.css

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

101 1934 101 1934 0 0 3184 0--:--:----:--:----:--:--7136


[[email protected] ~]$ curl-u Username: password-o http://blog.51yip.com/demo/curtain/bbstudy_files/style.css

% total% Received% xferd Average speed Time Time current

Dload Upload Total spent

101 1934 101 1934 0 0 3184 0--:--:----:--:----:--:--7136

or view copy printing in the following way?

[[email protected] ~]$ Curl-o ftp://user name: Password @ip:port/demo/curtain/bbstudy_files/style.css


[[email protected] ~]$ Curl-o ftp://user name: Password @ip:port/demo/curtain/bbstudy_files/style.css

15, upload via FTP


[[email protected] ~]$ curl-t test.sql ftp://user name: Password @ip:port/demo/curtain/bbstudy_files/


[[email protected] ~]$ curl-t test.sql ftp://user name: Password @ip:port/demo/curtain/bbstudy_files/

3


This article is from the "Operation and maintenance House (Q Group: 1991706)" blog, please be sure to keep this source http://304076020.blog.51cto.com/7503470/1550158

Linux Curl Command detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.