# GET (googleのtoppageが返却) curl "https://www.google.com" # ファイル出力時の進捗状況を非表示 curl -s "https://www.google.com" # ステータスコードを最後に出力:-w '%{http_code}\n' curl -s "https://www.google.com" -w '%{http_code}\n' # curl実行結果の出力先を指定:-o curl -o ./hoge.txt -s "https://www.google.com" # /dev/null はデータ全捨て、以下curlはステータスコード表示のみ curl -o /dev/null -w '%{http_code}\n' -s "https://www.google.com" # GET以外のリクエスト:-X [http method] # 以下URLだとエラー、status405(Method Not Allowed)返却 curl -X POST -o /dev/null -w '%{http_code}\n' -s "https://www.google.com" # その他 # -H カスタムヘッダー # -d リクエストパラメータ(GET以外)、別ファイルからの指定も可能
参考にさせていただいたサイト
curlコマンド入門 #初心者向け - Qiita
よく使うcurlコマンドのオプション #Linux - Qiita
curlコマンドでデータを送るときに、ファイルに保存されたデータを使う #Linuxコマンド - Qiita