·터미널 명령어

wget

네트워크

쓰는 꼴

wget [options] <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은 무엇을 하나요?

주소를 파일로 내려받고 넘김도 알아서 따라갑니다 — curl은 시키지 않으면 화면에 뿌리는 것이 차이이고, macOS에는 기본으로 깔려 있지 않습니다.

Q. 어떻게 치나요?

wget [options] <url> — 대괄호는 생략할 수 있는 자리입니다.

Q. 옵션은 몇 개나 자주 쓰나요?

여기 정리한 것은 7개입니다. 전체 목록은 man wget에 있습니다. 이 명령은 네트워크 갈래입니다.

같이 보는 명령

man 페이지: man wget