Linux curl命令参数详解

简介:
一、Linux curl用法举例:
1. linux curl抓取网页:

抓取百度:


1

curl http://www.baidu.com


如发现乱码,可以使用iconv转码:


1

curl http://iframe.ip138.com/ic.asp|iconv -fgb2312

iconv的用法请参阅:在Linux/Unix系统下用iconv命令处理文本文件中文乱码问题


2. Linux curl使用代理

linux curl使用http代理抓取页面:

1

2

curl -x 111.95.243.36:80 http://iframe.ip138.com/ic.asp|iconv -fgb2312

curl -x 111.95.243.36:80 -U aiezu:password http://www.baidu.com


使用socks代理抓取页面:

1

2

curl --socks4 202.113.65.229:443 http://iframe.ip138.com/ic.asp|iconv -fgb2312

curl --socks5 202.113.65.229:443 http://iframe.ip138.com/ic.asp|iconv -fgb2312


代理服务器地址可以从爬虫代理上获取。


3. linux curl处理cookies

接收cookies:

1

curl -c /tmp/cookies http://www.baidu.com #cookies保存到/tmp/cookies文件


发送cookies:

1

2

curl -b "key1=val1;key2=val2;" http://www.baidu.com #发送cookies文本

curl -b /tmp/cookies http://www.baidu.com #从文件中读取cookies



4. linux curl发送数据:

linux curl get方式提交数据:

1

curl -G -d "name=value&name2=value2" http://www.baidu.com


linux curl post方式提交数据:

1

2

curl -d "name=value&name2=value2" http://www.baidu.com #post数据

curl -d a=b&c=d&txt@/tmp/txt http://www.baidu.com  #post文件

以表单的方式上传文件:

1

curl -F file=@/tmp/me.txt http://www.aiezu.com


相当于设置form表单的method="POST"和enctype='multipart/form-data'两个属性。


5. linux curl http header处理:

设置http请求头信息:

1

2

3

curl -A "Mozilla/5.0 Firefox/21.0" http://www.baidu.com #设置http请求头User-Agent

curl -e "http://pachong.org/" http://www.baidu.com #设置http请求头Referer

curl -H "Connection:keep-alive \n User-Agent: Mozilla/5.0" http://www.aiezu.com

设置http响应头处理:

1

2

curl -I http://www.aiezu.com #仅仅返回header

curl -D /tmp/header http://www.aiezu.com #将http header保存到/tmp/header文件

6. linux curl认证:


1

2

curl -u aiezu:password http://www.aiezu.com #用户名密码认证

curl -E mycert.pem https://www.baidu.com #采用证书认证


6. 其他:


1

2

curl -# http://www.baidu.com #以“#”号输出进度条

curl -o /tmp/aiezu http://www.baidu.com #保存http响应到/tmp/aiezu


一、查看网页源码

   直接在curl命令后加上网址,就可以看到网页源码。我们以网址www.sina.com为例(选择该网址,主要因为它的网页代码较短)

curl www.baidu.com

   如果要把这个网页保存下来,可以使用-o参数,这就相当于使用wget命令了。

curl -o [文件名] www.baidu.com

  二、自动跳转 有的网址是自动跳转的。使用-L参数,curl就会跳转到新的网址

curl -L http://item.taobao.com/item.htm?id=25823396605 键入上面的命令,结果就自动跳转为http://detail.tmall.com/item.htm?id=25823396605

   三、显示头信息 -i 参数可以显示http response的头信息,连同网页代码一起

(-I 参数则是只显示http response的头信息。)

curl -i www.baidu.com
 HTTP/1.1 200 OK
Date: Fri, 28 Feb 2014 05:39:57 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: Keep-Alive
Vary: Accept-Encoding
Set-Cookie: BAIDUID=0F251A658E427EBB7CBEB0C3F4A70FAE:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; d
omain=.baidu.com
Set-Cookie: BDSVRTM=0; path=/Set-Cookie: H_PS_PSSID=4104_5231_1445_5139_5225_5378_5368_4261_4760_5400; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "Expires: Fri, 28 Feb 2014 05:39:45 GMT
Cache-Control: privateServer: BWS/1.1BDPAGETYPE: 1BDQID: 0xc3b306dca955703dBDUSERID: 0.....

   四、显示通信过程 -v 参数可以显示一次http通信的整个过程,包括端口连接和http request头信息

命令:curl -v www.baidu.com

* About to connect() to www.baidu.com port 80

*   Trying 115.239.210.26... connected

* Connected to www.baidu.com (115.239.210.26) port 80

> GET / HTTP/1.1

> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

> Host: www.baidu.com

> Accept: */*

>

< HTTP/1.1 200 OK

< Date: Fri, 28 Feb 2014 05:42:37 GMT

< Content-Type: text/html

< Transfer-Encoding: chunked

< Connection: Keep-Alive

< Vary: Accept-Encoding

< Set-Cookie: BAIDUID=442AD49501EF253AE71F2BAF3E0181FB:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com

< Set-Cookie: BDSVRTM=0; path=/

< Set-Cookie: H_PS_PSSID=5228_1461_5187_5138_5225_5379_5368_4261_4760_5401_5286; path=/; domain=.baidu.com

< P3P: CP=" OTI DSP COR IVA OUR IND COM "

< Expires: Fri, 28 Feb 2014 05:41:43 GMT

< Cache-Control: private

< Server: BWS/1.1

< BDPAGETYPE: 1

< BDQID: 0x906950d16fb1e95d

< BDUSERID: 0

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                Dload  Upload   Total   Spent    Left  Spee

="X-UA-Compatible" content="IE=Edge">  如果你觉得上面的信息还不够,那么下面的命令可以查看更详细的通信过程:

curl --trace output.txt www.baidu.com 或者

curl --trace-ascii output.txt www.baidu.com 运行后,请打开output.txt文件查看。

   当然也有更狠的,查看页面跳转过程:

curl -L -I --trace log http://item.taobao.com/item.htm?id=25823396605

HTTP/1.1 301 Moved Permanently

Server: Tengine

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html;charset=GBK

Content-Length: 0

Connection: close

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Content-Language: zh-CN

Accept-Ranges: bytes

X-Varnish: 1206961665

Via: 1.1 varnish

location: http://detail.tmall.com/item.htm?id=25823396605&

X-Cache: MISS

Cache-Control: max-age=3


HTTP/1.1 302 Found

Server: Tengine

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: keep-alive

at_bucketid: sbucket_-1

X-Bucket-Id: -1

Location: http://jump.taobao.com/jump?target=http%3a%2f%2fdetail.tmall.com%2fitem.htm%3fid%3d25823396605%26%26tbpm%3d1

Cache-Control:


HTTP/1.1 302 Found

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: close

Set-Cookie: _tb_token_=ktbzEwzFR6qy;domain=.taobao.com;Path=/;HttpOnly

Set-Cookie: cookie2=6c6bc65b9e9a5159cff5b3d0cae4dfd9;domain=.taobao.com;Path=/;HttpOnly

Set-Cookie: t=d768c73859b40e10ef81f7abd0824704;domain=.taobao.com;Expires=Thu, 29-May-2014 06:16:01 GMT;Path=/

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Location: http://pass.tmall.com/add?_tb_token_=ktbzEwzFR6qy&cookie2=6c6bc65b9e9a5159cff5b3d0cae4dfd9&t=d768c73859b40e10ef81f7abd0824704&target=http%3a%2f%2fdetail.tmall.com%2fitem.htm%3fid%3d25823396605%26%26tbpm%3d1&pacc=A_12nKe89qHIcAyauBtovg==&opi=110.75.118.230&tmsc=1393568161483632


HTTP/1.1 302 Found

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: close

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Set-Cookie: _tb_token_=ktbzEwzFR6qy;domain=.tmall.com;Path=/

Set-Cookie: cookie2=6c6bc65b9e9a5159cff5b3d0cae4dfd9;domain=.tmall.com;Path=/

Set-Cookie: t=d768c73859b40e10ef81f7abd0824704;domain=.tmall.com;Path=/

Location: http://detail.tmall.com/item.htm?id=25823396605&&tbpm=1


HTTP/1.1 302 Found

Server: Tengine

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: keep-alive

at_bucketid: sbucket_-1

X-Bucket-Id: -1

Location: http://jump.taobao.com/jump?target=http%3a%2f%2fdetail.tmall.com%2fitem.htm%3fid%3d25823396605%26%26tbpm%3d2

Cache-Control:


HTTP/1.1 302 Found

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: close

Set-Cookie: _tb_token_=GgU93fEjKGT4;domain=.taobao.com;Path=/;HttpOnly

Set-Cookie: cookie2=ef3c440d74ff391de6b560da4ef8a5c9;domain=.taobao.com;Path=/;HttpOnly

Set-Cookie: t=187a71d8df58caac2c4e08d40245c31f;domain=.taobao.com;Expires=Thu, 29-May-2014 06:16:01 GMT;Path=/

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Location: http://pass.tmall.com/add?_tb_token_=GgU93fEjKGT4&cookie2=ef3c440d74ff391de6b560da4ef8a5c9&t=187a71d8df58caac2c4e08d40245c31f&target=http%3a%2f%2fdetail.tmall.com%2fitem.htm%3fid%3d25823396605%26%26tbpm%3d2&pacc=Vo8f-VlYEYPJ6WE3iTX96Q==&opi=110.75.118.230&tmsc=1393568161501736


HTTP/1.1 302 Found

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: close

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Set-Cookie: _tb_token_=GgU93fEjKGT4;domain=.tmall.com;Path=/

Set-Cookie: cookie2=ef3c440d74ff391de6b560da4ef8a5c9;domain=.tmall.com;Path=/

Set-Cookie: t=187a71d8df58caac2c4e08d40245c31f;domain=.tmall.com;Path=/

Location: http://detail.tmall.com/item.htm?id=25823396605&&tbpm=2


HTTP/1.1 302 Found

Server: Tengine

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: keep-alive

at_bucketid: sbucket_-1

X-Bucket-Id: -1

Location: http://jump.taobao.com/jump?target=http%3a%2f%2fdetail.tmall.com%2fitem.htm%3fid%3d25823396605%26%26tbpm%3d3

Cache-Control:


HTTP/1.1 302 Found

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: close

Set-Cookie: _tb_token_=Uta86PoG6cWC;domain=.taobao.com;Path=/;HttpOnly

Set-Cookie: cookie2=cd06dba05f2bf1124200861d0b8a151b;domain=.taobao.com;Path=/;HttpOnly

Set-Cookie: t=618388c77aff03aec08309747a82f440;domain=.taobao.com;Expires=Thu, 29-May-2014 06:16:01 GMT;Path=/

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Location: http://pass.tmall.com/add?_tb_token_=Uta86PoG6cWC&cookie2=cd06dba05f2bf1124200861d0b8a151b&t=618388c77aff03aec08309747a82f440&target=http%3a%2f%2fdetail.tmall.com%2fitem.htm%3fid%3d25823396605%26%26tbpm%3d3&pacc=RptvnJCXDG4WtvFa0JIqoQ==&opi=110.75.118.230&tmsc=1393568161510003


HTTP/1.1 302 Found

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html

Content-Length: 260

Connection: close

P3P: CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR'

Set-Cookie: _tb_token_=Uta86PoG6cWC;domain=.tmall.com;Path=/

Set-Cookie: cookie2=cd06dba05f2bf1124200861d0b8a151b;domain=.tmall.com;Path=/

Set-Cookie: t=618388c77aff03aec08309747a82f440;domain=.tmall.com;Path=/

Location: http://detail.tmall.com/item.htm?id=25823396605&&tbpm=3


HTTP/1.1 200 OK

Server: Tengine

Date: Fri, 28 Feb 2014 06:16:01 GMT

Content-Type: text/html;charset=GBK

Connection: keep-alive

Vary: Accept-Encoding

at_bucketid: sbucket_-1

X-Bucket-Id: -1

Cache-Control: max-age=1

At_Autype: 4_103979994

At_Cat: item_50018599

X-Category: /cat/50008090

At_Nick: %E8%B6%8A%E5%BA%A6%E6%95%B0%E7%A0%81%E4%B8%93%E8%90%A5%E5%BA%97

At_Itemid: 25823396605

At_Isb: 1

At_Pgty: 2

At_Cat: 50018599

At_Brid: 272676782

At_Prid: 221236332

At_Autype: 0_103979994

At_Auid: 25823396605

Content-Language: zh-CN

X-Cache: MISS TCP_MISS dirn:-2:-2

Via: wagbridge010207087016.cm3:8888

五、发送表单信息 发送表单信息有GET和POST两种方法。

GET方法相对简单,只要把数据附在网址后面就行:

curl baidu.com/form.cgi?data=xxx

   POST方法必须把数据和网址分开,例如:

curl -d "method=searchone&module=seller&user_name=wb-liqiu&nickname=dd" -H"Host:fmp.view.lz.taobao.com" "10.235.160.141:8082/api.php"

   六、文件上传 假定文件上传的表单你可以用curl这样上传文件,命令:

curl --form upload=@localfilename --form press=OK http://www.baidu.com

   七、Referer字段 有时你需要在http request头信息中,提供一个referer字段,表示你是从哪里跳转过来的:

curl --referer http://www.baidu.com http://www.baidu.com

   八、User Agent字段 这个字段是用来表示客户端的设备信息。服务器有时会根据这个字段,针对不同设备,返回不同格式的网页,比如手机版和桌面版。 iPhone4的User Agent是: “Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7”。curl可以这样模拟: curl --user-agent "[User Agent]" [URL]

   九、cookie 使用--cookie参数,可以让curl发送cookie

curl --cookie "name=xxx" www.baidu.com 至于具体的cookie的值,可以从http response头信息的Set-Cookie字段中得到。也可以例如:

curl -c ./cookie.txt http://www.baidu.com

   十、增加头信息 有时需要在http request之中,自行增加一个头信息。--header参数就可以起到这个作用。

curl --header "xxx: xxxxxx" http://baidu.com

   十一、HTTP认证 有些网域需要HTTP认证,这时curl需要用到--user参数:

curl --user name:password baidu.com

 
    

   十二、设置代理缓存 -x

curl -L -x127.0.0.1:13128 http://detail.tmall.com/item.htm?id=25823396605


下载单个文件,默认将输出打印到标准输出中(STDOUT)中

curl http://www.centos.org


通过-o/-O选项保存下载的文件到指定的文件中:

-o:将文件保存为命令行中指定的文件名的文件中

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


# 将文件下载到本地并命名为mygettext.html


curl -o mygettext.html http://www.gnu.org/software/gettext/manual/gettext.html


# 将文件保存到本地并命名为gettext.html

curl -O http://www.gnu.org/software/gettext/manual/gettext.html


同样可以使用转向字符">"对输出进行转向输出


同时获取多个文件

curl -O URL1 -O URL2


若同时从同一站点下载多个文件时,curl会尝试重用链接(connection)。

通过-L选项进行重定向


默认情况下CURL不会发送HTTP Location headers(重定向).

当一个被请求页面移动到另一个站点时,会发送一个HTTP Loaction

header作为请求,然后将请求重定向到新的地址上。

例如:访问google.com时,会自动将地址重定向到google.com.hk上。

curl http://www.google.com

 

 

 

  Moved

 

 

  Moved

 The document has moved

 here.

 

 

这是可以通过使用-L选项进行强制重定向

1 # 让curl使用地址重定向,此时会查询google.com.hk站点

2 curl -L http://www.google.com


断点续传

通过使用-C选项可对大文件使用断点续传功能,如:

# 当文件在下载完成之前结束该进程

$ curl -O http://www.gnu.org/software/gettext/manual/gettext.html

##############       .%

# 通过添加-C选项继续对该文件进行下载,已经下载过的文件不会被重新下载

curl -C - -O http://www.gnu.org/software/gettext/manual/gettext.html

###############      .

对CURL使用网络限速

通过--limit-rate选项对CURL的最大网络使用进行限制

# 下载速度最大不会超过1000B/second
curl --limit-rate 1000B -O http://www.gnu.org/software/gettext/manual/gettext.html
下载指定时间内修改过的文件

当下载一个文件时,可对该文件的最后修改日期进行判断,如果该文件在指定日期内修改过,就进行下载,否则不下载。
该功能可通过使用-z选项来实现:

# 若yy.html文件在2011/12/21之后有过更新才会进行下载
curl -z 21-Dec-11

CURL授权

在访问需要授权的页面时,可通过-u选项提供用户名和密码进行授权

curl -u username:password URL
# 通常的做法是在命令行只输入用户名,之后会提示输入密码,这样可以保证在查看历史记录时不会将密码泄露
4 curl -u username URL

从FTP服务器下载文件

CURL同样支持FTP下载,若在url中指定的是某个文件路径而非具体的某个要下载的文件名,CURL则会列出该目录下的所有文件名而并非下载该目录下的所有文件

# 列出public_html下的所有文件夹和文件
curl -u ftpuser:ftppass -O ftp://ftp_server/public_html/
# 下载xss.php文件
curl -u ftpuser:ftppass -O ftp://ftp_server/public_html/xss.php
上传文件到FTP服务器


通过 -T 选项可将指定的本地文件上传到FTP服务器上



# 将myfile.txt文件上传到服务器


curl -u ftpuser:ftppass -T myfile.txt ftp://ftp.testserver.com


# 同时上传多个文件


curl -u ftpuser:ftppass -T "{file1,file2}" ftp://ftp.testserver.com


# 从标准输入获取内容保存到服务器指定的文件中


curl -u ftpuser:ftppass -T - ftp://ftp.testserver.com/myfile_1.txt


获取更多信息

通过使用 -v 和 -trace获取更多的链接信息


保存与使用网站cookie信息

# 将网站的cookies信息保存到sugarcookies文件中
curl -D sugarcookies http://localhost/sugarcrm/index.php 
# 使用上次保存的cookie信息
curl -b sugarcookies http://localhost/sugarcrm/index.php
传递请求数据

默认curl使用GET方式请求数据,这种方式下直接通过URL传递数据


可以通过 --data/-d 方式指定使用POST方式传递数据

# GET
curl -u username https://api.github.com/user?access_token=XXXXXXXXXX


 # POST
curl -u username --data "param=valuem=value" https://api.github.com


# 也可以指定一个文件,将该文件中的内容当作数据传递给服务器端


curl --data @filename https://github.api.com/authorizations

注:默认情况下,通过POST方式传递过去的数据中若有特殊字符,首先需要将特殊字符转义再传递给服务器端,如value值中包含有空格,则需要先将空格转换成%20,如:

curl -d "value%201" 

在新版本的CURL中,提供了新的选项 --data-urlencode,通过该选项提供的参数会自动转义特殊字符

curl --data-urlencode "value 1"

除了使用GET和POST协议外,还可以通过 -X 选项指定其它协议,如:

curl -I -X DELETE https://api.github.cim

上传文件

curl --form "fileupload=@filename.txt" http://hostname/resource


1、抓取cokkie信息到一个文件中

curl -c cookie0.txt -d "username=****&password=***" http://www.kuaipan.cn/accounts/login/

2、get方法获取信息

curl -G -I -o xsrf.txt -b cookie1.txt -c cookie2.txt


显示下载进度条
# curl -# -O

7:不会显示下载进度信息

# curl -s -O http://www.linux.com/dodo1.JPG











本文转自 chengxuyonghu 51CTO博客,原文链接:http://blog.51cto.com/6226001001/1896688,如需转载请自行联系原作者

目录
相关文章
|
3月前
|
Linux 应用服务中间件 Shell
二、Linux文本处理与文件操作核心命令
熟悉了Linux的基本“行走”后,就该拿起真正的“工具”干活了。用grep这个“放大镜”在文件里搜索内容,用find这个“探测器”在系统中寻找文件,再用tar把东西打包带走。最关键的是要学会使用管道符|,它像一条流水线,能把这些命令串联起来,让简单工具组合出强大的功能,比如 ps -ef | grep 'nginx' 就能快速找出nginx进程。
469 1
二、Linux文本处理与文件操作核心命令
|
3月前
|
Linux
linux命令—stat
`stat` 是 Linux 系统中用于查看文件或文件系统详细状态信息的命令。相比 `ls -l`,它提供更全面的信息,包括文件大小、权限、所有者、时间戳(最后访问、修改、状态变更时间)、inode 号、设备信息等。其常用选项包括 `-f` 查看文件系统状态、`-t` 以简洁格式输出、`-L` 跟踪符号链接,以及 `-c` 或 `--format` 自定义输出格式。通过这些选项,用户可以灵活获取所需信息,适用于系统调试、权限检查、磁盘管理等场景。
325 137
|
3月前
|
安全 Ubuntu Unix
一、初识 Linux 与基本命令
玩转Linux命令行,就像探索一座新城市。首先要熟悉它的“地图”,也就是/根目录下/etc(放配置)、/home(住家)这些核心区域。然后掌握几个“生存口令”:用ls看周围,cd去别处,mkdir建新房,cp/mv搬东西,再用cat或tail看文件内容。最后,别忘了随时按Tab键,它能帮你自动补全命令和路径,是提高效率的第一神器。
751 57
|
6月前
|
JSON 自然语言处理 Linux
linux命令—tree
tree是一款强大的Linux命令行工具,用于以树状结构递归展示目录和文件,直观呈现层级关系。支持多种功能,如过滤、排序、权限显示及格式化输出等。安装方法因系统而异常用场景包括:基础用法(显示当前或指定目录结构)、核心参数应用(如层级控制-L、隐藏文件显示-a、完整路径输出-f)以及进阶操作(如磁盘空间分析--du、结合grep过滤内容、生成JSON格式列表-J等)。此外,还可生成网站目录结构图并导出为HTML文件。注意事项:使用Tab键补全路径避免错误;超大目录建议限制遍历层数;脚本中推荐禁用统计信息以优化性能。更多详情可查阅手册mantree。
577 143
linux命令—tree
|
2月前
|
存储 安全 Linux
Linux卡在emergency mode怎么办?xfs_repair 命令轻松解决
Linux虚拟机遇紧急模式?别慌!多因磁盘挂载失败。本文教你通过日志定位问题,用`xfs_repair`等工具修复文件系统,三步快速恢复。掌握查日志、修磁盘、验重启,轻松应对紧急模式,保障系统稳定运行。
533 2
|
3月前
|
缓存 监控 Linux
Linux内存问题排查命令详解
Linux服务器卡顿?可能是内存问题。掌握free、vmstat、sar三大命令,快速排查内存使用情况。free查看实时内存,vmstat诊断系统整体性能瓶颈,sar实现长期监控,三者结合,高效定位并解决内存问题。
341 0
Linux内存问题排查命令详解
|
3月前
|
Unix Linux 程序员
Linux文本搜索工具grep命令使用指南
以上就是对Linux环境下强大工具 `grep` 的基础到进阶功能介绍。它不仅能够执行简单文字查询任务还能够处理复杂文字处理任务,并且支持强大而灵活地正则表达规范来增加查询精度与效率。无论您是程序员、数据分析师还是系统管理员,在日常工作中熟练运用该命令都将极大提升您处理和分析数据效率。
321 16
|
5月前
|
监控 Linux 网络安全
Linux命令大全:从入门到精通
日常使用的linux命令整理
924 13
|
6月前
|
Linux 网络安全 数据安全/隐私保护
使用Linux系统的mount命令挂载远程服务器的文件夹。
如此一来,你就完成了一次从你的Linux发车站到远程服务器文件夹的有趣旅行。在这个技术之旅中,你既探索了新地方,也学到了如何桥接不同系统之间的距离。
1122 21
|
6月前
|
监控 Linux
Linux系统中使用df命令详解磁盘使用情况。
`df`命令是Linux系统管理员和用户监控和管理磁盘空间使用的重要工具。掌握它的基本使用方法和选项可以帮助在必要时分析和解决空间相关问题。简洁但功能丰富,`df`命令确保了用户可以快速有效地识别和管理文件系统的空间使用情况。
481 13