linux下解压.git,linux下万能解压的几种方法.md
## 万能脚本解压法代码如下:```sh#!/bin/sh## Usage: extract # Description: extracts archived files / mounts disk images# Note: .dmg/hdiutil is macOS-specific.## credit: http://nparikh.org/notes/zshrc.txtextract ()
## 万能脚本解压法
代码如下:
```sh
#!/bin/sh
#
# Usage: extract
# Description: extracts archived files / mounts disk images
# Note: .dmg/hdiutil is macOS-specific.
#
# credit: http://nparikh.org/notes/zshrc.txt
extract () {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar -jxvf $1 ;;
*.tar.gz) tar -zxvf $1 ;;
*.bz2) bunzip2 $1 ;;
*.dmg) hdiutil mount $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar -xvf $1 ;;
*.tbz2) tar -jxvf $1 ;;
*.tgz) tar -zxvf $1 ;;
*.zip) unzip $1 ;;
*.ZIP) unzip $1 ;;
*.pax) cat $1 | pax -r ;;
*.pax.Z) uncompress $1 --stdout | pax -r ;;
*.rar) unrar x $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted/mounted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
```
使用命令:
```sh
extract 文件名
```
## 最简单的alias缩写法
```sh
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'
```
将上列命令加你的配置文件,或者直接在sh下输入即可。适合新手与小白,因为不会破坏文件。
## aunpack
属于atool下的一个子命令,需要先安装atool。
```
sudo apt install atool -y
aunpack # 解压即可
```
## 7z x
```
7z x
```
解压对应的文件。
一键复制
编辑
Web IDE
原始数据
按行查看
历史
更多推荐
所有评论(0)