Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
如何优雅的在终端解压缩压缩包
deepin Talks
885
views ·
6
replies ·
To
floor
Go
BingoLove
deepin
2017-08-24 05:56
Author
压缩包格式千奇百怪,根本记不住每种格式的解压命令怎么办?
每次解压都要思考一下?太累
懒癌犯了,还是可以治的,下面是药
把下面的代码加到 .zshrc 的最后面重启终端就可以了。如果用gonme终端的话就加 .bashrc
以后解压的时候只需要 extract 文件名就行了,自动选择解压命令
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $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 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
Copy the Code
Reply
Like 0
Favorite
View the author
All Replies
wangyong
deepin
2017-08-24 06:03
#1
牛逼
Reply
Like 0
View the author
pikachuhy
deepin
2017-08-24 06:05
#2
*.rar) unrar e $1 ;;
Copy the Code
解rar这么解会出事的
你解个ucf101试试
我今天就被坑了
Reply
Like 0
View the author
billy123456
deepin
2017-08-24 06:09
#3
一律7z x
Reply
Like 0
View the author
dikas2015
deepin
2017-08-24 07:41
#4
厉害,收藏了
Reply
Like 0
View the author
要讲武德
deepin
2017-08-24 09:08
#5
fish终端路过...
Reply
Like 0
View the author
kikyoulzg
deepin
2017-08-24 15:17
#6
收藏,3楼的情况是?
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
Nuntia - Modern IMAP/SMTP mail client for Deepin (Beta tester wanted!)
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Four agent skills for laptop power, sleep, and honest bug reports
Popular Events
More
每次解压都要思考一下?太累
懒癌犯了,还是可以治的,下面是药
把下面的代码加到 .zshrc 的最后面重启终端就可以了。如果用gonme终端的话就加 .bashrc
以后解压的时候只需要 extract 文件名就行了,自动选择解压命令