Online Linux Terminal Logo
OnlineLinuxTerminal
网络与传输CLI Manual

$curl

通过 HTTP、HTTPS、FTP 和 REST API 在网络服务器之间传输数据。

命令语法POSIX Standard
curl [OPTIONS] [URL...]
Linux 社区2.4k 在线

与真实 Linux 用户交流,学习常用命令并免费获取精美速查表 PDF。

在交互式终端沙盒中实时运行

无需安装的客户端实时仿真环境。

在全屏终端工作区中打开 ↗
bash — terminal

概述与工作原理

curl 是最强大的网络数据传输与接口调试工具,广泛用于接口测试与文件下载。

常用参数与选项说明

Flag / OptionDescription
-I, --headFetch HTTP response headers only without downloading body.
-L, --locationFollow HTTP 301/302 redirects automatically.
-X, --request [METHOD]Specify custom HTTP request method (GET, POST, PUT, DELETE).
-d, --data [data]Send POST data payload in request body.
-H, --header [header]Pass custom HTTP request header (e.g., "Authorization: Bearer token").
-o [file]Write output to file instead of stdout.

实际生产案例与代码范例

#1Inspect HTTP response headers of a website
curl -I https://onlinelinuxterminal.com

Fetches HTTP status code, content-type, cache-control, and server headers.

#2Download a remote file
curl -O https://example.com/archive.zip

Downloads archive.zip preserving remote file name.