wget

ネットワーク

書き方

wget [options] <url>

URL をファイルとして落とし、転送も自分で追います。curl は指示しなければ画面に出すのが違いで、macOS には既定で入っていません。

よく使うオプション

オプション意味
-O <file>Choose the output name; -O - writes to stdout like curl does.
-cContinue a partly downloaded file instead of starting over.
-qQuiet. Pair with -O - to pipe the body somewhere.
-P <dir>Put downloads into a directory.
-r -np -kRecursive mirror, never climb above the start URL, rewrite links for local reading.
--limit-rate=1mCap the bandwidth so the download does not saturate the line.
-NOnly fetch if the remote file is newer than the local copy.

wget -c https://example.com/big.iso

Resume a large download after the connection dropped.

wget -r -np -k https://example.com/docs/

Mirror a documentation tree for offline reading.

wget -qO- https://example.com | head

Behave like curl and print to the terminal.

つながらないとき、どこまで行けたのかを絞ります — 名前が引けないのか、経路がないのか、ポートが閉じているのか。

読み方

  • 角括弧 [ ] は省いてよい部分です。
  • 三点 … は複数並べられるという意味です。
  • オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。

よくある質問

Q. wget は何をしますか。

URL をファイルとして落とし、転送も自分で追います。curl は指示しなければ画面に出すのが違いで、macOS には既定で入っていません。

Q. どう打ちますか。

wget [options] <url> — 角括弧は省いてよい部分です。

Q. よく使うオプションはいくつですか。

ここにまとめたのは7個です。全部は man wget にあります。このコマンドはネットワークの仲間です。

関連するコマンド

man ページ: man wget