to be
a problem slover

extract file while downloading to save space

Q: Let’s say you have 200G disk space, you need download a 110G tar file and extract it in same disk, so it takes 220G at least, the extract will fail. so what you can do?

A: You can extract the tar file while downloading, and only keep the extracted file, with this command

wget -q -O- <URL> | tar zxvf -


-q: Turn off Wget’s output, so there’s no wget-output file.

-O flag is the short notation for the flag –output-document in wget command-line utility.

The hypen - after the flag denotes STDOUT.

So -O- means get as a file and print the result on STDOUT.

Learn By Example

  • wget -O writes the output to index.html file
  • wget -O custom.txt writes the output to your custom.txt file as mentioned
  • wget -O – writes output to your terminal’s STDOUT


赞(0) 打赏
欢迎转载,注明出处:刘世明的博客 » extract file while downloading to save space

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址