原文:linux一次性解压多个.gz或者.tar.gz文件

解压多个压缩包

对于解压多个.gz文件的,用此命令:

for gz in *.gz; do gunzip $gz; done

对于解压多个.tar.gz文件的,用下面命令:

for tar in *.tar.gz;  do tar xvf $tar; done

扩展:tar命令

tar [-] A --catenate --concatenate | c --create | d --diff --compare | --delete | r --append | t --list |
--test-label | u --update | x --extract --get [options] [pathname ...]
-A, --catenate, --concatenate
append tar files to an archive
-c, --create
create a new archive
-d, --diff, --compare
find differences between archive and file system
--delete
delete from the archive (not on mag tapes!)
-r, --append
append files to the end of an archive
-t, --list
list the contents of an archive
--test-label
test the archive volume label and exit
-u, --update
only append files newer than copy in archive
-x, --extract, --get
extract files from an archive
-a, --auto-compress
use archive suffix to determine the compression program
--add-file=FILE
add given FILE to the archive (useful if its name starts with a dash)
--anchored
patterns match file name start
--no-anchored
patterns match after any `/' (default for exclusion)
--atime-preserve
preserve access times on dumped files, either by restoring the times
--no-auto-compress
do not use archive suffix to determine the compression program
-b, --blocking-factor BLOCKS
BLOCKS x 512 bytes per record
-B, --read-full-records
reblock as we read (for 4.2BSD pipes)
--backup
backup before removal, choose version CONTROL
-C, --directory DIR
change to directory DIR
--check-device
check device numbers when creating incremental archives (default)
--no-check-device
do not check device numbers when creating incremental archives
--checkpoint
display progress messages every NUMBERth record (default 10)
--checkpoint-action=ACTION
execute ACTION on each checkpoint
--delay-directory-restore
delay setting modification times and permissions of extracted
--no-delay-directory-restore
cancel the effect of --delay-directory-restore option
--exclude=PATTERN
exclude files, given as a PATTERN
--exclude-backups
exclude backup and lock files
--exclude-caches
exclude contents of directories containing CACHEDIR.TAG,
--exclude-caches-all
exclude directories containing CACHEDIR.TAG
--exclude-caches-under
exclude everything under directories containing CACHEDIR.TAG
--exclude-tag=FILE
exclude contents of directories containing FILE, except
--exclude-tag-all=FILE
exclude directories containing FILE
--exclude-tag-under=FILE
exclude everything under directories containing FILE
--exclude-vcs
exclude version control system directories
-f, --file ARCHIVE
use archive file or device ARCHIVE
-F, --info-script, --new-volume-script NAME
run script at end of each tape (implies -M)
--force-local
archive file is local even if it has a colon
--full-time
print file time to its full resolution
-g, --listed-incremental FILE
handle new GNU-format incremental backup
-G, --incremental
handle old GNU-format incremental backup
--group=NAME
force NAME as group for added files
-h, --dereference
follow symlinks; archive and dump the files they point to
-H, --format FORMAT
create archive of the given formatFORMAT is one of the following:
--format=gnu
GNU tar 1.13.x format
--format=oldgnu
GNU format as per tar <= 1.12
--format=pax
POSIX 1003.1-2001 (pax) format
--format=posix
same as pax
--format=ustar
POSIX 1003.1-1988 (ustar) format
--format=v7
old V7 tar format
--hard-dereference
follow hard links; archive and dump the files they refer to
-i, --ignore-zeros
ignore zeroed blocks in archive (means EOF)
-I, --use-compress-program PROG
filter through PROG (must accept -d)
--ignore-case
ignore case
--no-ignore-case
case sensitive matching (default)
--ignore-command-error
ignore exit codes of children
--no-ignore-command-error
treat non-zero exit codes of children as error
--ignore-failed-read
do not exit with nonzero on unreadable files
--index-file=FILE
send verbose output to FILE
-j, --bzip2
-J, --xz
-k, --keep-old-files
don't replace existing files when extracting
-K, --starting-file MEMBER-NAME
begin at member MEMBER-NAME in the archive
--keep-newer-files
don't replace existing files that are newer than their archive copies
-l, --check-links
print a message if not all links are dumped
-L, --tape-length NUMBER
change tape after writing NUMBER x 1024 bytes
--level=NUMBER
dump level for created listed-incremental archive
--lzip
--lzma
--lzop
-m, --touch
don't extract file modified time
-M, --multi-volume
create/list/extract multi-volume archive
--mode=CHANGES
force (symbolic) mode CHANGES for added files
--mtime=DATE-OR-FILE
set mtime for added files from DATE-OR-FILE
-n, --seek
archive is seekable
-N, --newer, --after-date DATE-OR-FILE
only store files newer than DATE-OR-FILE
--newer-mtime=DATE
compare date and time when data changed only
--null
-T reads null-terminated names, disable -C
--no-null
disable the effect of the previous --null option
--numeric-owner
always use numbers for user/group names
-O, --to-stdout
extract files to standard output
--occurrence
process only the NUMBERth occurrence of each file in the archive;
--old-archive, --portability
same as --format=v7
--one-file-system
stay in local file system when creating archive
--overwrite
overwrite existing files when extracting
--overwrite-dir
overwrite metadata of existing directories when extracting (default)
--no-overwrite-dir
preserve metadata of existing directories
--owner=NAME
force NAME as owner for added files
-p, --preserve-permissions, --same-permissions
extract information about file permissions (default for superuser)
-P, --absolute-names
don't strip leading `/'s from file names
--pax-option=keyword[[:]=value][,keyword[[:]=value]]...
control pax keywords
--posix
same as --format=posix
--preserve
same as both -p and -s
--quote-chars=STRING
additionally quote characters from STRING
--no-quote-chars=STRING
disable quoting for characters from STRING
--quoting-style=STYLE
set name quoting style; see below for valid STYLE values
-R, --block-number
show block number within archive with each message
--record-size=NUMBER
NUMBER of bytes per record, multiple of 512
--recursion
recurse into directories (default)
--no-recursion
avoid descending automatically in directories
--recursive-unlink
empty hierarchies prior to extracting directory
--remove-files
remove files after adding them to the archive
--restrict
disable use of some potentially harmful options
--rmt-command=COMMAND
use given rmt COMMAND instead of rmt
--rsh-command=COMMAND
use remote COMMAND instead of rsh
-s, --preserve-order, --same-order
sort names to extract to match archive
-S, --sparse
handle sparse files efficiently
--same-owner
try extracting files with the same ownership as exists in the archive (default for superuser)
--no-same-owner
extract files as yourself (default for ordinary users)
--no-same-permissions
apply the user's umask when extracting permissions from the archive (default for ordinary users)
--no-seek
archive is not seekable
--show-defaults
show tar defaults
--show-omitted-dirs
when listing or extracting, list each directory that does not match search criteria
--show-transformed-names, --show-stored-names
show file or archive names after transformation
--sparse-version=MAJOR[.MINOR]
set version of the sparse format to use (implies --sparse)
--strip-components=NUMBER
strip NUMBER leading components from file names on extraction
--suffix=STRING
backup before removal, override usual suffix ('~' unless overridden by environment variable
SIMPLE_BACKUP_SUFFIX)
-T, --files-from FILE
get names to extract or create from FILE
--to-command=COMMAND
pipe extracted files to another program
--totals
print total bytes after processing the archive;
--transform, --xform EXPRESSION
use sed replace EXPRESSION to transform file names
-U, --unlink-first
remove each file prior to extracting over it
--unquote
unquote filenames read with -T (default)
--no-unquote
do not unquote filenames read with -T
--utc
print file modification times in UTC
-v, --verbose
verbosely list files processed
-V, --label TEXT
create archive with volume name TEXT; at list/extract time, use TEXT as a globbing pattern for volume
name
--volno-file=FILE
use/update the volume number in FILE
-w, --interactive, --confirmation
ask for confirmation for every action
-W, --verify
attempt to verify the archive after writing it
--warning=KEYWORD
warning control
--wildcards
use wildcards (default for exclusion)
--wildcards-match-slash
wildcards match `/' (default for exclusion)
--no-wildcards-match-slash
wildcards do not match `/'
--no-wildcards
verbatim string matching
-X, --exclude-from FILE
exclude patterns listed in FILE
-z, --gzip, --gunzip --ungzip
-Z, --compress, --uncompress

【Linux命令】linux一次性解压多个.gz或者.tar.gz文件的更多相关文章

  1. linux下压缩与解压(zip、unzip、tar)详解

    linux下压缩与解压(zip.unzip.tar)详解 2012-05-09 13:58:39| 分类: linux | 标签:linux zip unzip tar linux命令详解 |举报|字 ...

  2. 自己封装Linux命令行万能解压命令

    问题背景 Linux下经常需要解压文件,直接在命令行敲命令解压是最便捷的. 但问题在于,不同的压缩格式,需要用不同命令和不同参数,完全记不住啊. 解决方式 既然记不住,那就换一种思路,假如有一条命令能 ...

  3. linux命令:压缩解压打包工具大集合

    目录 (1)zip 压缩.解压缩及归档工具有很多,今天小编就整理几个大家较为常用的. compress gzip  bzip2 xz zip tar cpio 一.压缩.解压工具 用法 压缩 工具 压 ...

  4. linux命令(及解压tar.gz文件)

    https://wenku.baidu.com/view/f5805017866fb84ae45c8df3.html 1.压缩命令: 命令格式:tar  -zcvf   压缩文件名.tar.gz   ...

  5. Linux中MySQL5.5解压版普通用户安装

    #查看本机mysql 安装路径 [hadoop@SY-0134 toolkit]$ rpm -qa|grep -i mysql [hadoop@SY-0134 toolkit]$ whereis my ...

  6. Linux的压缩解压命令快速上手——解压篇

    在Linux系统中,压缩文件通常是先将若干文件(包括目录)打包成一个tar文件,然后再调用压缩程序将tar文件压缩成相应的压缩包,这也就是为什么Linux系的压缩包的后缀通常都是像tar.gz,tar ...

  7. linux安装jdk及解压命令

    注意事项:虚拟机安装的系统,不能从桌面直接拖拽传输文件,否则解压出错 查看系统自带安装的java rpm -qa | grep java 删除非.noarch文件 rpm -e --nodeps 文件 ...

  8. (转)使用 linux tar 命令压缩与解压文件

    原文链接 http://www.cnblogs.com/qq78292959/archive/2011/07/06/2099427.html tar -c: 建立压缩档案-x:解压-t:查看内容-r: ...

  9. 浅谈Linux下各种压缩 解压命令和压缩比率对比

    Linux下压缩.解压命令五花八门,不像在windows下一个winrar打遍天下无敌手,清一色的.rar .zip格式. 比如,Linux下常用的tar tar.gz tar.bz2 .Z等等不一而 ...

随机推荐

  1. PHP 高并发秒杀解决方案

    本文提供 PHP 高并发秒杀解决方案(附加三个案例说明(普通流程,使用文件锁,使用redis消息队列)) 1:(正常流程,不做任何高并发处理),代码如下: <?php $_mysqli = ne ...

  2. java 代理模式(静态代理、动态代理、Cglib代理) 转载

    Java的三种代理模式 1.代理模式 代理(Proxy)是一种设计模式,提供了对目标对象另外的访问方式;即通过代理对象访问目标对象.这样做的好处是:可以在目标对象实现的基础上,增强额外的功能操作,即扩 ...

  3. Azure系列2.1.11 —— CloudBlobContainer

    (小弟自学Azure,文中有不正确之处,请路过各位大神指正.) 网上azure的资料较少,尤其是API,全是英文的,中文资料更是少之又少.这次由于公司项目需要使用Azure,所以对Azure的一些学习 ...

  4. C++常用宏

    宏是由 #define 定义而来,在预处理阶段进行宏展开,它的格式是: #define N 2 + 2 // 仅仅是字符串替换 #define N (2 + 2) // 也是字符串 ,但是是(2 + ...

  5. Oracle字符函数length substr concat实例

    --字符函数 --伪表dual --(1)求字符串长度 select length('123.456/-*') from dual --(2)截取函数求字符串的子串 ,) from dual --(3 ...

  6. css3的clip-path方法剪裁实现

    本例讲解如何通过clip-path把一个div(元素,可以是图片等)裁切成不同的形状,这里以一个div为例宽高均为300px 注意:不支持IE和Firefox,支持webkit浏览器,在现代浏览器中需 ...

  7. Django Rest framework 框架之认证使用和源码执行流程

    用这个框架需要先安装: pip3 install djangorestframework 如果写了一个CBV的东西,继承了View. # 继承Django里面View class APIView(Vi ...

  8. java.io.FileNotFoundException关于使用Intellij Idea时系统找不到指定文件的解决方案

    第一种:Intellij Idea 这个智障编辑器 在用的时候 是你在这个web目录下的空文件夹他是不给你部署的 解决在空文件夹下面随便放个文件夹就行了 第二种:也是最笨的方法,但是有前提条件就是 你 ...

  9. 关于controller的书写

    private Logger log = LoggerFactory.getLogger(ReportFormController.class); // 读取配置文件 ResourceBundle r ...

  10. socket基础编程-2

    client端: import socket while True: client=socket.socket(socket.ANET,socket.SOCK_STREAM) client.conne ...