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 -

Notes

-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 liushiming.cn writes the output to index.html file
  • wget -O custom.txt liushiming.cn writes the output to your custom.txt file as mentioned
  • wget -O – liushiming.cn writes output to your terminal’s STDOUT

Reference

https://stackoverflow.com/questions/9830242/what-does-wget-o-mean

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

评论 抢沙发

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

觉得文章有用就打赏一下作者

支付宝扫一扫打赏

微信扫一扫打赏