文章

好用的linux指令總匯

壓縮


壓縮資料夾

用tar壓縮

1
tar -zcvf file_name.tar.gz dir_name

參數

  • -z : Filter the archive through gzip(1).
  • -c : Create a new archive.
  • -v : Verbosely list files processed.
  • -f : Archive file name

用pigz壓縮(平行化,用所有CPU加速)

1
tar -I pigz -cvf file_name.tar.gz dir_name

參數:

  • -I : –use-compress-program

解壓縮資料夾

跟壓縮一樣,只是-c變成-x,代表extract。

Wget


Downloading small Google Drive Files using WGET (less than 100MB)

First get the FILEID from the URL link.

1
export FILEID =
1
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=${FILEID}' -O FILENAME

Downloading large Google Drive Files using WGET (over 100MB)

1
export FILEID =
1
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=${FILEID}' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${FILEID}" -O FILENAME && rm -rf /tmp/cookies.txt
本文章以 CC BY 4.0 授權