【チートシート】curlコマンド入門

Linux

はじめに

curlコマンドのチートシートです。

よく使いそうな使い方をまとめておきました。

チートシート

オプション実行例説明
オプション無しcurl sample.comGETリクエスト
-ocurl sample.com –o /tmp/log.txtファイル出力
–trace-asciicurl –trace-ascii sample.comリクエスト、レスポンスをasciiでダンプ
–helpcurl –helpヘルプを出力
-Xcurl –X POST sample.comメソッドの指定(例ではPOST)
-Icurl –I sample.comヘッダー情報のみ
-vcurl –v sample.com詳細表示、デバッグで利用
–remote-namecurl –remote-name “https://sample.com/linux.isoファイルのダウンロード、ファイル名は変更なし
-ucurl –u <ID>:<Pass> https://sample.comBASIC認証
-w”%{time_total}\n”curl -w”%{time_total}\n” https://sample.com実行時間の出力
-Hcurl -H “Authorization: token トークン” https://sample.comRequestヘッダーに追加

コメント

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny

タイトルとURLをコピーしました