美文网首页
Linux命令 | gzip

Linux命令 | gzip

作者: 泼皮混混 | 来源:发表于2022-03-30 00:00 被阅读0次

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的时候,要解压缩则要加入参数-d;一定要保证解压缩的文件是完整的、无损坏的(如果是解压数据,数据不完整,是会报错的)

$ 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 #查看压缩后的行数,这个行数不一定是4的整数倍

zcat CRR126317_f1.fq.gz  #直接查看gz压缩文件的内容

#先输出两个文件的内容,然后把内容压缩成一个文件
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] 文件与目录 .... 
      参数: 
      -c :建立一个压缩文件的参数指令(create 的意思); 
      -x :解开一个压缩文件的参数指令! 
      -t :查看 tarfile 里面的文件! 
      特别注意,在参数的下达中, c/x/t 仅能存在一个!不可同时存在! 
      因为不可能同时压缩与解压缩。 
      -z :是否同时具有 gzip 的属性?亦即是否需要用 gzip 压缩? 
      -j :是否同时具有 bzip2 的属性?亦即是否需要用 bzip2 压缩? 
      -v :压缩的过程中显示文件!这个常用,但不建议用在背景执行过程! 
      -f :使用档名,请留意,在 f 之后要立即接档名喔!不要再加参数!

相关文章

网友评论

      本文标题:Linux命令 | gzip

      本文链接:https://www.haomeiwen.com/subject/gbafdrtx.html