gzip是在Linux上進行解壓及壓縮的命令
$ gzip -h
Usage: gzip [OPTION]... [FILE]...
#壓縮或解壓縮文件,默認是壓縮文件,壓縮后原文件就消失了
Compress or uncompress FILEs (by default, compress FILES in-place).
Mandatory arguments to long options are mandatory for short options too.
-c, --stdout write on standard output, keep original files unchanged
-d, --decompress decompress(解壓縮)
-f, --force force overwrite of output file and compress links
-h, --help give this help
-l, --list list compressed file contents
-L, --license display software license
-n, --no-name do not save or restore the original name and time stamp
-N, --name save or restore the original name and time stamp
-q, --quiet suppress all warnings
-r, --recursive operate recursively on directories
-S, --suffix=SUF use suffix SUF on compressed files
-t, --test test compressed file integrity
-v, --verbose verbose mode
-V, --version display version number
-1, --fast compress faster
-9, --best compress better
--rsyncable Make rsync-friendly archive
在用gzip的時候,要解壓縮則要加入?yún)?shù)-d;一定要保證解壓縮的文件是完整的、無損壞的(如果是解壓數(shù)據(jù),數(shù)據(jù)不完整,是會報錯的)
$ gzip -d DRR119244_1.fastq.gz
gzip: DRR119244_1.fastq.gz: unexpected end of file
另外,要提取fastq文件要4行4行的取,截取前400行
head -400 DRR119244_1.fastq | > sample.fastq
wc -l CRR126317_f1.fq.gz #查看壓縮后的行數(shù),這個行數(shù)不一定是4的整數(shù)倍
zcat CRR126317_f1.fq.gz #直接查看gz壓縮文件的內(nèi)容
#先輸出兩個文件的內(nèi)容,然后把內(nèi)容壓縮成一個文件
zcat Sample_test_1.R1.fastq.gz Sample_test_2.R2.fastq.gz | gzip - > test.fastq.gz
#要比zcat快
cat Sample_test_1.R1.fastq.gz Sample_test_2.R2.fastq.gz > test2.fastq.gz
tar -xzvf .tar.gz
tar [-cxtzjvfpPN] 文件與目錄 ....
參數(shù):
-c :建立一個壓縮文件的參數(shù)指令(create 的意思);
-x :解開一個壓縮文件的參數(shù)指令!
-t :查看 tarfile 里面的文件!
特別注意,在參數(shù)的下達中, c/x/t 僅能存在一個!不可同時存在!
因為不可能同時壓縮與解壓縮。
-z :是否同時具有 gzip 的屬性?亦即是否需要用 gzip 壓縮?
-j :是否同時具有 bzip2 的屬性?亦即是否需要用 bzip2 壓縮?
-v :壓縮的過程中顯示文件!這個常用,但不建議用在背景執(zhí)行過程!
-f :使用檔名,請留意,在 f 之后要立即接檔名喔!不要再加參數(shù)!