是否有用于压缩/解压缩 snappy 的好的命令行工具?

Dav*_*rks 6 command-line

我有一些活泼的文件,我希望能够在命令行上压缩/解压缩它们。我没有看到任何明显的工具,是否有人们用于 snappy 的标准?

nik*_*hil 3

这是我很久以前在拱门论坛上发现的一个宝石,在使用它之前,您应该拥有7zipunrar/或其他工具来处理您需要提取的格式。

# File extractor
# usage: extract <file>
extract ()
{
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2)   tar xjf $1   ;;
      *.tar.gz)    tar xzf $1   ;;
      *.bz2)       bunzip2 $1   ;;
      *.rar)       unrar x $1     ;;
      *.gz)        gunzip $1    ;;
      *.tar)       tar xf $1    ;;
      *.tbz2)      tar xjf $1   ;;
      *.tgz)       tar xzf $1   ;;
      *.zip)       unzip $1     ;;
      *.Z)         uncompress $1;;
      *.7z)        7z x $1      ;;
      *.snz)       snunzip $1      ;;
      *)           echo "'$1' cannot be extracted via extract()" ;;
    esac
  else
    echo "'$1' is not a valid file"
  fi
}
Run Code Online (Sandbox Code Playgroud)

要使用它,您必须将其添加到您的文件中.bash_profile,或者.profile完成后您可以使用它extract从命令行解压缩所有类型的存档。语法是extract name-of-archive

您也可以将它与 snappy 一起使用,但是您需要先安装才能工作。

  • 呃,为什么不从安装 `snzip` 开始回答呢。你提到的“7zip”和“unrar”与snappy无关。 (2认同)