是否有用于压缩/解压缩快照的良好命令行工具?[关闭]


6

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


2
老实说,我不认为这是Ubuntu特有的问题。您应该宁愿通过电子邮件询问该工具的作者,也可以不询问他们的论坛
Melon 2012年

Answers:


2

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

# 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
}

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

你可以用活泼的使用也一样,你需要安装但它会工作之前。


问题是有关一种特定的文件格式,即快照,您的答案没有提到。
sierrasdetandil

@sierrasdetandil也添加了一些细节,以使其也可以与快照结合使用。我的答案是分享一个我个人认为非常有用的技巧,并且可以扩展为几乎任何文件格式。
nikhil 2012年

我了解,我只是指出它没有回答问题。现在,我已删除我的否决票。
sierrasdetandil

@sierrasdetandil公平点!
nikhil 2012年

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.