原文: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 |