linux的解压命令
Linux操作系统中,.zip、.tar、.tar.gz、.tar.bz2、.tar.xz、.jar、.7z等格式的压缩与解压

Linux操作系统中,*.zip、*.tar、*.tar.gz、*.tar.bz2、*.tar.xz、*.jar、*.7z等格式的压缩与解压zip格式压缩: zip -r [目标文件名].zip [原文件/目录名]解压: unzip [原文件名].zip注:-r参数代表递归tar格式(该格式仅仅打包,不压缩)打包:tar -cvf[目标文件名].tar [原文件名/目录名]解包:tar -xvf[原文件名].tar注:c参数代表create(创建),x参数代表extract(解包),v参数代表verbose(详细信息),f参数代表filename(文件名),所以f后必须接文件名。
tar.gz格式方式一:利用前面已经打包好的tar文件,直接用压缩命令。
压缩:gzip[原文件名].tar解压:gunzip[原文件名].tar.gz方式二:一次性打包并压缩、解压并解包打包并压缩: tar -zcvf[目标文件名].tar.gz [原文件名/目录名]解压并解包: tar -zxvf[原文件名].tar.gz注:z代表用gzip算法来压缩/解压。
tar.bz2格式方式一:利用已经打包好的tar文件,直接执行压缩命令:压缩:bzip2 [原文件名].tar解压:bunzip2 [原文件名].tar.bz2方式二:一次性打包并压缩、解压并解包打包并压缩: tar -jcvf[目标文件名].tar.bz2 [原文件名/目录名]解压并解包: tar -jxvf[原文件名].tar.bz2注:小写j代表用bzip2算法来压缩/解压。
tar.xz格式方式一:利用已经打包好的tar文件,直接用压缩命令:压缩:xz[原文件名].tar解压:unxz[原文件名].tar.xz方式二:一次性打包并压缩、解压并解包打包并压缩: tar -Jcvf[目标文件名].tar.xz[原文件名/目录名]解压并解包: tar -Jxvf[原文件名].tar.xz注:大写J代表用xz算法来压缩/解压。
Linux终端命令gzi文件压缩与解压

Linux终端命令gzi文件压缩与解压Linux终端命令gzip文件压缩与解压在Linux系统中,gzip是一个常用的文件压缩和解压缩工具。
它可以将文件压缩为.gz格式,并能够解压缩.gz文件。
本文将介绍gzip的基本使用方法以及一些常用选项,帮助读者熟练运用gzip进行文件压缩和解压缩。
一、gzip的基本使用方法1. 压缩文件要使用gzip命令对文件进行压缩,只需要在终端中输入以下命令:```gzip [选项] 文件名```其中,选项是可选的,可以根据需要选择是否使用。
文件名是要进行压缩的文件的名称。
例如,要压缩名为file.txt的文本文件,可以使用以下命令:```gzip file.txt```执行后,gzip会将file.txt压缩为file.txt.gz文件,原始文件file.txt 会被删除。
2. 解压缩文件要解压缩.gz文件,可以使用以下命令:```gzip -d [选项] 文件名.gz```其中,选项是可选的,文件名.gz是要进行解压缩的压缩文件的名称。
例如,要解压缩名为file.txt.gz的压缩文件,可以使用以下命令:```gzip -d file.txt.gz```执行后,gzip会将file.txt.gz解压缩并恢复为file.txt文件,原始的.gz文件会被删除。
二、常用选项gzip命令提供了一些常用选项,可以根据需要进行使用,下面介绍几个常用的选项:1. -c,--stdout使用-c或--stdout选项时,gzip命令将会把压缩文件的结果输出到标准输出,而不是写入到硬盘上的文件。
例如,要将file.txt压缩并将结果输出到标准输出,可以使用以下命令:```gzip -c file.txt```2. -f,--force使用-f或--force选项时,gzip命令将会强制覆盖已存在的目标文件。
如果不使用该选项,当目标文件已存在时,gzip会询问是否覆盖。
例如,要强制压缩并覆盖已存在的file.txt.gz文件,可以使用以下命令:```gzip -f file.txt```3. -r,--recursive使用-r或--recursive选项时,gzip命令将会递归地压缩目录下的所有文件。
【Linux命令】linux一次性解压多个.gz或者.tar.gz文件

【Linux命令】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, --concatenateappend tar files to an archive-c, --createcreate a new archive-d, --diff, --comparefind differences between archive and file system--deletedelete from the archive (not on mag tapes!)-r, --appendappend files to the end of an archive-t, --listlist the contents of an archive--test-labeltest the archive volume label and exit-u, --updateonly append files newer than copy in archive-x, --extract, --getextract files from an archive-a, --auto-compressuse archive suffix to determine the compression program--add-file=FILEadd given FILE to the archive (useful if its name starts with a dash)--anchoredpatterns match file name start--no-anchoredpatterns match after any `/' (default for exclusion)--atime-preservepreserve access times on dumped files, either by restoring the times--no-auto-compressdo not use archive suffix to determine the compression program-b, --blocking-factor BLOCKSBLOCKS x 512 bytes per record-B, --read-full-recordsreblock as we read (for 4.2BSD pipes)--backupbackup before removal, choose version CONTROL-C, --directory DIRchange to directory DIR--check-devicecheck device numbers when creating incremental archives (default)--no-check-devicedo not check device numbers when creating incremental archives--checkpointdisplay progress messages every NUMBERth record (default 10)--checkpoint-action=ACTIONexecute ACTION on each checkpoint--delay-directory-restoredelay setting modification times and permissions of extracted--no-delay-directory-restorecancel the effect of --delay-directory-restore option--exclude=PATTERNexclude files, given as a PATTERN--exclude-backupsexclude backup and lock files--exclude-cachesexclude contents of directories containing CACHEDIR.TAG,--exclude-caches-allexclude directories containing CACHEDIR.TAG--exclude-caches-underexclude everything under directories containing CACHEDIR.TAG--exclude-tag=FILEexclude contents of directories containing FILE, except--exclude-tag-all=FILEexclude directories containing FILE--exclude-tag-under=FILEexclude everything under directories containing FILE--exclude-vcsexclude version control system directories-f, --file ARCHIVEuse archive file or device ARCHIVE-F, --info-script, --new-volume-script NAMErun script at end of each tape (implies -M)--force-localarchive file is local even if it has a colon--full-timeprint file time to its full resolution-g, --listed-incremental FILEhandle new GNU-format incremental backup-G, --incrementalhandle old GNU-format incremental backup--group=NAMEforce NAME as group for added files-h, --dereferencefollow symlinks; archive and dump the files they point to-H, --format FORMATcreate archive of the given formatFORMAT is one of the following: --format=gnuGNU tar 1.13.x format--format=oldgnuGNU format as per tar <= 1.12--format=paxPOSIX 1003.1-2001 (pax) format--format=posixsame as pax--format=ustarPOSIX 1003.1-1988 (ustar) format--format=v7old V7 tar format--hard-dereferencefollow hard links; archive and dump the files they refer to-i, --ignore-zerosignore zeroed blocks in archive (means EOF)-I, --use-compress-program PROGfilter through PROG (must accept -d)--ignore-caseignore case--no-ignore-casecase sensitive matching (default)--ignore-command-errorignore exit codes of children--no-ignore-command-errortreat non-zero exit codes of children as error--ignore-failed-readdo not exit with nonzero on unreadable files--index-file=FILEsend verbose output to FILE-j, --bzip2-J, --xz-k, --keep-old-filesdon't replace existing files when extracting-K, --starting-file MEMBER-NAMEbegin at member MEMBER-NAME in the archive--keep-newer-filesdon't replace existing files that are newer than their archive copies -l, --check-linksprint a message if not all links are dumped-L, --tape-length NUMBERchange tape after writing NUMBER x 1024 bytes--level=NUMBERdump level for created listed-incremental archive--lzip--lzma--lzop-m, --touchdon't extract file modified time-M, --multi-volumecreate/list/extract multi-volume archive--mode=CHANGESforce (symbolic) mode CHANGES for added files--mtime=DATE-OR-FILEset mtime for added files from DATE-OR-FILE-n, --seekarchive is seekable-N, --newer, --after-date DATE-OR-FILEonly store files newer than DATE-OR-FILE--newer-mtime=DATEcompare date and time when data changed only--null-T reads null-terminated names, disable -C--no-nulldisable the effect of the previous --null option--numeric-owneralways use numbers for user/group names-O, --to-stdoutextract files to standard output--occurrenceprocess only the NUMBERth occurrence of each file in the archive;--old-archive, --portabilitysame as --format=v7--one-file-systemstay in local file system when creating archive--overwriteoverwrite existing files when extracting--overwrite-diroverwrite metadata of existing directories when extracting (default)--no-overwrite-dirpreserve metadata of existing directories--owner=NAMEforce NAME as owner for added files-p, --preserve-permissions, --same-permissionsextract information about file permissions (default for superuser)-P, --absolute-namesdon't strip leading `/'s from file names--pax-option=keyword[[:]=value][,keyword[[:]=value]]...control pax keywords--posixsame as --format=posix--preservesame as both -p and -s--quote-chars=STRINGadditionally quote characters from STRING--no-quote-chars=STRINGdisable quoting for characters from STRING--quoting-style=STYLEset name quoting style; see below for valid STYLE values-R, --block-numbershow block number within archive with each message--record-size=NUMBERNUMBER of bytes per record, multiple of 512--recursionrecurse into directories (default)--no-recursionavoid descending automatically in directories--recursive-unlinkempty hierarchies prior to extracting directory--remove-filesremove files after adding them to the archive--restrictdisable use of some potentially harmful options--rmt-command=COMMANDuse given rmt COMMAND instead of rmt--rsh-command=COMMANDuse remote COMMAND instead of rsh-s, --preserve-order, --same-ordersort names to extract to match archive-S, --sparsehandle sparse files efficiently--same-ownertry extracting files with the same ownership as exists in the archive (default for superuser)--no-same-ownerextract files as yourself (default for ordinary users)--no-same-permissionsapply the user's umask when extracting permissions from the archive (default for ordinary users) --no-seekarchive is not seekable--show-defaultsshow tar defaults--show-omitted-dirswhen listing or extracting, list each directory that does not match search criteria--show-transformed-names, --show-stored-namesshow file or archive names after transformation--sparse-version=MAJOR[.MINOR]set version of the sparse format to use (implies --sparse)--strip-components=NUMBERstrip NUMBER leading components from file names on extraction--suffix=STRINGbackup before removal, override usual suffix ('~' unless overridden by environment variableSIMPLE_BACKUP_SUFFIX)-T, --files-from FILEget names to extract or create from FILE--to-command=COMMANDpipe extracted files to another program--totalsprint total bytes after processing the archive;--transform, --xform EXPRESSIONuse sed replace EXPRESSION to transform file names-U, --unlink-firstremove each file prior to extracting over it--unquoteunquote filenames read with -T (default)--no-unquotedo not unquote filenames read with -T--utcprint file modification times in UTC-v, --verboseverbosely list files processed-V, --label TEXTcreate archive with volume name TEXT; at list/extract time, use TEXT as a globbing pattern for volume name--volno-file=FILEuse/update the volume number in FILE-w, --interactive, --confirmationask for confirmation for every action-W, --verifyattempt to verify the archive after writing it--warning=KEYWORDwarning control--wildcardsuse wildcards (default for exclusion)--wildcards-match-slashwildcards match `/' (default for exclusion)--no-wildcards-match-slashwildcards do not match `/'--no-wildcardsverbatim string matching-X, --exclude-from FILEexclude patterns listed in FILE-z, --gzip, --gunzip --ungzip-Z, --compress, --uncompress。
linux解压命令大全

压缩:zip FileName.zip DirName --------------------------------------------.rar 解压:rar x FileName.rar 压缩:rar a FileName.rar Dsrbin目录其他由path环境变量指定的目录也可以
linux解 压 命 令 大 全
.tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) --------------------------------------------.gz 解压1:gunzip FileName.gz 解压2:gzip -d FileName.gz 压缩:gzip FileName .tar.gz 和 .tgz 解压:tar zxvf FileName.tar.gz 压缩:tar zcvf FileName.tar.gz DirName --------------------------------------------.bz2 解压1:bzip2 -d FileName.bz2 解压2:bunzip2 FileName.bz2 压缩: bzip2 -z FileName .tar.bz2 解压:tar jxvf FileName.tar.bz2 压缩:tar jcvf FileName.tar.bz2 DirName --------------------------------------------.bz 解压1:bzip2 -d FileName.bz 解压2:bunzip2 FileName.bz 压缩:未知
Linux终端命令之压缩和解压缩

Linux终端命令之压缩和解压缩在Linux终端中,压缩和解压缩命令是非常常用的功能。
通过压缩,我们可以将多个文件或文件夹打包成一个压缩文件,从而方便传输和存储。
而解压缩则是将压缩文件还原为原始文件或文件夹。
本文将介绍Linux中常用的压缩和解压缩命令以及其使用方法。
1. gzip命令gzip命令是Linux中最常用的压缩命令之一,它使用Gzip算法压缩文件,并将压缩后的文件保存为以.gz为扩展名的文件。
以下是常用的gzip命令及其参数:1.1 压缩文件:使用gzip命令压缩文件非常简单,只需在终端输入以下命令:```gzip <filename>```例如,要压缩名为file.txt的文件,我们可以输入以下命令:```gzip file.txt```该命令会将file.txt文件压缩为file.txt.gz。
1.2 解压缩文件:要解压缩一个以.gz结尾的文件,可以使用以下命令:```gzip -d <filename.gz>```例如,要将file.txt.gz解压缩为file.txt,我们可以输入以下命令:```gzip -d file.txt.gz```2. tar命令tar命令用于将多个文件或文件夹打包成一个归档文件,常用的扩展名为.tar。
以下是常用的tar命令及其参数:2.1 打包文件或文件夹:使用tar命令打包文件非常简单,只需在终端输入以下命令:```tar -cvf <archive.tar> <file1> <file2> ...```例如,要将file1.txt和file2.txt打包成一个名为archive.tar的归档文件,我们可以输入以下命令:tar -cvf archive.tar file1.txt file2.txt```2.2 解包归档文件:要解包一个以.tar结尾的归档文件,可以使用以下命令:```tar -xvf <archive.tar>```例如,要将archive.tar解包,我们可以输入以下命令:```tar -xvf archive.tar```3. zip和unzip命令除了gzip和tar命令外,Linux还提供了zip和unzip命令,用于处理ZIP格式的压缩文件。
linux如何下解压windows下的.zip和.rar文件

linux如何下解压windows下的.zip和.rar⽂件linux⾃带的unzip命令可以解压windows下的zip格式的压缩⽂件。
unzip命令 语法:unzip [选项]压缩⽂件名.zip 各选项的含义分别为: -x ⽂件列表解压缩⽂件,但不包括指定的file⽂件。
-v 查看压缩⽂件⽬录,但不解压。
-t 测试⽂件有⽆损坏,但不解压。
-d ⽬录把压缩⽂件解到指定⽬录下。
-z 只显⽰压缩⽂件的注解。
-n 不覆盖已经存在的⽂件。
-o 覆盖已存在的⽂件且不要求⽤户确认。
-j 不重建⽂档的⽬录结构,把所有⽂件解压到同⼀⽬录下。
例1:将压缩⽂件text.zip在当前⽬录下解压缩。
例 $ unzip text.zip例2:将压缩⽂件text.zip在指定⽬录/tmp下解压缩,如果已有相同的⽂件存在,要求unzip命令不覆盖原先的⽂件。
例 $ unzip -n text.zip -d /tmp例3:查看压缩⽂件⽬录,但不解压。
例 $ unzip -v text.zip zgrep命令 这个命令的功能是在压缩⽂件中寻找匹配的正则表达式,⽤法和grep命令⼀样,只不过操作的对象是压缩⽂件。
如果⽤户想看看在某个压缩⽂件中有没有某⼀句话,便可⽤zgrep命令。
⼩技巧:当我们在windows下⽤ssh往linux中传送的⽂件较多时,可以先⽤winrar将其压缩成zip格式,然后再在linux中⽤unzip命令解压。
++++++++++++++++++++++++++++++++++++++++++Linux下如何解压.zip和.rar⽂件对于Window下的常见压缩⽂件.zip和.rar,也有相应的⽅法来解压它们:1)对于.ziplinux下提供了zip和unzip程序,zip是压缩程序,unzip是解压程序。
它们的参数选项很多,这⾥只做简单介绍,举例说明⼀下其⽤法:# zip all.zip *.jpg这条命令是将所有.jpg的⽂件压缩成⼀个zip包# unzip all.zip这条命令是将all.zip中的所有⽂件解压出来2)对于.rar要在linux下处理.rar⽂件,需要安装RAR for Linux,可以从⽹上下载,但要记住,RAR for Linux不是免费的;可从下载RAR 3。
linux下各种解压方法

linux下各种解压⽅法linux下各种格式的压缩包的压缩、解压⽅法。
但是部分⽅法我没有⽤到,也就不全,希望⼤家帮我补充,我将随时修改完善,谢谢! .tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ——————————————— .gz 解压 1:gunzip FileName.gz 解压2:gzip -d FileName.gz 压缩:gzip FileName .tar.gz 和 .tgz 解压:tar zxvf FileName.tar.gz 压缩:tar zcvf FileName.tar.gz DirName ——————————————— .bz2 解压1:bzip2 -d FileName.bz2 解压2:bunzip2 FileName.bz2 压缩: bzip2 -z FileName .tar.bz2 解压:tar jxvf FileName.tar.bz2 或tar --bzip xvf FileName.tar.bz2 压缩:tar jcvf FileName.tar.bz2 DirName ——————————————— .bz 解压1:bzip2 -d FileName.bz 解压2:bunzip2 FileName.bz 压缩:未知 .tar.bz 解压:tar jxvf FileName.tar.bz 压缩:未知 ——————————————— .Z 解压:uncompress FileName.Z 压缩:compress FileName .tar.Z 解压:tar Zxvf FileName.tar.Z 压缩:tar Zcvf FileName.tar.Z DirName ——————————————— .zip 解压:unzip FileName.zip 压缩:zip FileName.zip DirName 压缩⼀个⽬录使⽤ -r 参数,-r 递归。
linux解压常用命令

linux解压常⽤命令简介我们在操作linux服务器的时候会⽤到⼀些解压和压缩命令 .zip .gz .bz2 .tar.gz .tar.bz2,下⾯我对常⽤解压命令进⾏汇总。
1.tartar命令参数前⾯加”-"与不加“-”的区别:tar命令参数前⾯加不加“-”执⾏命令的结果是没有区别的,区别只要是在于linux风格⽅⾯,加“-”属于System V风格,不加“-”属于BSD风格,所以在使⽤tar命令的时候它的参数加不加“-”结果是⼀样的,看个⼈的使⽤⽅式;常⽤参数:选介绍项-z是否同时具有gz属性-j是否同时具有bz2属性-J是否同时具有xz属性-x解压缩、提取打包的内容-t查看压缩包内容-c建⽴⼀个压缩,打包⽂档-C切换到指定⽬录,表⽰指定解压缩包的内容和打包的内容存放的⽬录-v显⽰压缩或者打包的内容-f使⽤⽂件名,在f后⾯要接压缩后的⽂件的名字,只要⽤到tar命令,-f选项是必须要⽤的,-f参数在使⽤的时候⼀定排在其他参数的后⾯,在最右边-p保留备份数据的原本权限与属性,常⽤于备份(-c)重要的配置⽂件-P保留绝对路径(⼤写P)1.1.打包⽰例:a.将a.txt和b.txt打包成⼀个⽂件:tar -cvf test.tar a.txt b.txtb.查看test.tar⽂件中的内容:tar -tf test.tarc.提取test.tar⽂件中的内容到/test⽬录下:# 如果不⽤`-C`指定⽬录,默认是当前⽬录。
tar -xf test.tar -C /test1.2.压缩linux主要有三种压缩⽅式:.gzip:是公认的压缩这速度最快,压缩⼤⽂件的时候与其他的压缩⽅式相⽐更加明显,历史最久,应⽤最⼴泛的压缩⽅式.bzip:压缩形成的⽂件⼩,但是可⽤性不如gzip.xz:是最新的压缩⽅式,可以⾃动提供最佳的压缩率建议的压缩的时候标明后缀:作⽤命名⽅式参数参数作⽤-z⽤于gzip压缩⽅式⽂件名.tar.gz-j⽤于bzip2压缩⽅式⽂件名.tar.bz2-J⽤于xz压缩⽅式⽂件名.tar.xz⽰例:a.⽤gzip的压缩⽅式将test.log⽂件压缩为test.tar.gz⽂件:tar -zcvf test.tar.gz test.logb.⽤bzip2的压缩⽅式将test.log⽂件压缩为test.tar.bz2⽂件tar -jcvf test.tar.bz2 test.log在压缩的过程中,我们可以发现:压缩速度:gz > bz2 > xz压缩率:xz > bz2 > gz1.3.解压tar命令在解压的时候不需要指明⾃⼰压缩的⽅式它会⾃⼰选择跟压缩⽂件对应的⽅式去解压:a.将test.tar.gz解压到当前⽬录tar -xf test.tar.gzb.将test.tar.bz2⽂件解压在/test⽬录下:tar -xf test.tar.bz2 -C /test补充a.在打包和压缩的过程中,我们有时候会看到这样的语句:tar: 从成员名中删除开头的“/”,这个并不是报错,是因为没有加上-P选项,没有保留原来的绝对路径去打包或者压缩,提取打包的内容跟解压⼀样,下⾯举⼀个例⼦:压缩# 不加'P'tar -zcvf test.tar.gz /test# 加'P'tar -zcvPf test.tar.gz /test解压# 不加'P'tar -xvf test.tar.gz -C /test# 加'P'tar -xvPf test.tar.gz -C /testb.在使⽤tar压缩或者打包的时候,可以通过增加--exclude来达到排除指定的⽂件的⽬的# 排除`test`⽂件夹中的`a.txt`⽂件tar -cvf test.tar --exclude=a.txt test2.zipzip 是个使⽤⼴泛的压缩程序,压缩后的⽂件后缀名为 .zip。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
linux的解压命令Linux系统下解压缩包的操作可以通过命令来实现,下面由小编为大家整理了linux的解压命令,希望对大家有帮助!linux下的解压命令详解linux解压命令1.tartar命令详解-c: 建立压缩档案-x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个。
下面的参数是根据需要在压缩或解压档案时可选的。
-z:有gzip属性的-j:有bz2属性的-Z:有compress属性的-v:显示所有过程-O:将文件解开到标准输出参数-f是必须的-f: 使用档案名字,切记,这个参数是最后一个参数,后面只能接档案名。
tar -cf all.tar *.jpg 这条命令是将所有.jpg的文件打成一个名为all.tar的包。
-c是表示产生新的包,-f指定包的文件名。
tar -rf all.tar *.gif 这条命令是将所有.gif的文件增加到all.tar的包里面去。
-r是表示增加文件的意思。
tar -uf all.tar logo.gif 这条命令是更新原来tar包all.tar 中logo.gif文件,-u是表示更新文件的意思。
tar -tf all.tar 这条命令是列出all.tar包中所有文件,-t是列出文件的意思tar -xf all.tar 这条命令是解出all.tar包中所有文件,-x是解开的意思tar -tf aaa.tar.gz 在不解压的情况下查看压缩包的内容查看tar -tf aaa.tar.gz 在不解压的情况下查看压缩包的内容压缩tar –cvf jpg.tar *.jpg //将目录里所有jpg文件打包成tar.jpgtar –czf jpg.tar.gz *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用gzip压缩,生成一个gzip压缩过的包,命名为jpg.tar.gztar –cjf jpg.tar.bz2 *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用bzip2压缩,生成一个bzip2压缩过的包,命名为jpg.tar.bz2tar –cZf jpg.tar.Z *.jpg //将目录里所有jpg文件打包成jpg.tar后,并且将其用compress压缩,生成一个umcompress 压缩过的包,命名为jpg.tar.Z解压tar –xvf file.tar //解压tar包tar -xzvf file.tar.gz //解压tar.gztar -xjvf file.tar.bz2 //解压tar.bz2tar –xZvf file.tar.Z //解压tar.Zlinux解压命令2..gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz压缩:gzip FileNamelinux解压命令3..tar.gz 和 .tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirNamelinux解压命令4..bz2功能说明:.bz2文件的解压缩程序。
语法:bunzip2 [-fkLsvV][.bz2压缩文件]补充说明:bunzip2可解压缩.bz2格式的压缩文件。
bunzip2实际上是bzip2的符号连接,执行bunzip2与bzip2 -d的效果相同。
参数:-f或--force 解压缩时,若输出的文件与现有文件同名时,预设不会覆盖现有的文件。
若要覆盖,请使用此参数。
-k或--keep 在解压缩后,预设会删除原来的压缩文件。
若要保留压缩文件,请使用此参数。
-s或--small 降低程序执行时,内存的使用量。
-v或--verbose 解压缩文件时,显示详细的信息。
-l,--license,-V或--version 显示版本信息。
解压1:bzip2 -d FileName.bz2解压2:bunzip2 FileName.bz2压缩:bzip2 -z FileNamelinux解压命令5..tar.bz2解压:tar jxvf FileName.tar.bz2压缩:tar jcvf FileName.tar.bz2 DirName linux解压命令6..bz解压1:bzip2 -d FileName.bz解压2:bunzip2 FileName.bz压缩:未知linux解压命令7..tar.bz解压:tar jxvf FileName.tar.bz压缩:未知linux解压命令8..Z解压:uncompress FileName.Z压缩:compress FileNamelinux解压命令9..tar.Z解压:tar Zxvf FileName.tar.Z压缩:tar Zcvf FileName.tar.Z DirName linux解压命令10..zip语法:zip [参数] [压缩名] [要压缩的文件或目录...] zip [-AcdDfFghjJKlLmoqrSTuvVwXyz$] [-b <工作目录>][-ll][-n <字尾字符串>][-t <日期时间>][-<压缩效率>][压缩文件][文件...][-i <范本样式>][-x <范本样式>]参数:-A 调整可执行的自动解压缩文件。
-b<工作目录> 指定暂时存放文件的目录。
-c 替每个被压缩的文件加上注释。
-d 从压缩文件内删除指定的文件。
-D 压缩文件内不建立目录名称。
-f 此参数的效果和指定"-u"参数类似,但不仅更新既有文件,如果某些文件原本不存在于压缩文件内,使用本参数会一并将其加入压缩文件中。
-F 尝试修复已损坏的压缩文件。
-g 将文件压缩后附加在既有的压缩文件之后,而非另行建立新的压缩文件。
-h 在线帮助。
-i<范本样式> 只压缩符合条件的文件。
-j 只保存文件名称及其内容,而不存放任何目录名称。
-J 删除压缩文件前面不必要的数据。
-k 使用MS-DOS兼容格式的文件名称。
-l 压缩文件时,把LF字符置换成LF+CR字符。
-ll 压缩文件时,把LF+CR字符置换成LF字符。
-L 显示版权信息。
-m 将文件压缩并加入压缩文件后,删除原始文件,即把文件移到压缩文件中。
-n<字尾字符串> 不压缩具有特定字尾字符串的文件。
-o 以压缩文件内拥有最新更改时间的文件为准,将压缩文件的更改时间设成和该文件相同。
-q 不显示指令执行过程。
-r 递归处理,将指定目录下的所有文件和子目录一并处理。
-S 包含系统和隐藏文件。
-t<日期时间> 把压缩文件的日期设成指定的日期。
-T 检查备份文件内的每个文件是否正确无误。
-u 更换较新的文件到压缩文件内。
-v 显示指令执行过程或显示版本信息。
-V 保存VMS操作系统的文件属性。
-w 在文件名称里假如版本编号,本参数仅在VMS操作系统下有效。
-x<范本样式> 压缩时排除符合条件的文件。
-X 不保存额外的文件属性。
-y 直接保存符号连接,而非该连接所指向的文件,本参数仅在UNIX之类的系统下有效。
-z 替压缩文件加上注释。
-$ 保存第一个被压缩文件所在磁盘的卷册名称。
-<压缩效率> 压缩效率是一个介于1-9的数值。
解压:unzip FileName.zip压缩:zip FileName.zip DirNamelinux解压命令11..rar用法:rar <命令> -<选项1> ….-<选项N> <操作文档> <文件…> <@文件列表…> <解压路径>通常rar命令由一个主命令加若干选项(可选)构成,操作文档为操作施加的.rar文件对象,文件或文件列表为对操作文档实现修饰的具体文件或目录(可选)。
rar常用命令a 添加文件到操作文档例:rar a test.rar file1.txt 若test.rar文件不存在,则打包file1.txt文件成test.rar例:rar a test.rar file2.txt 若test.rar文件已经存在,则添加file2.txt文件到test.rar中(这样test.rar中就有两个文件了)注,如果操作文档中已有某文件的一份拷贝,则a命令更新该文件,对目录也可以进行操作例:rar a test.rar dir1c 对操作文档添加说明注释rar c test.rar(会出现Reading comment from stdin字样,然后输入一行或多行注释,以ctrl+d结束)cf 添加文件注释,类似上面的c,不过这个是对压缩文档中每个文件进行注释cw 将文档注释写入文件例:rar cw test.rar comment.txtd 从文档中删除文件例:rar d test.rar file1.txte 将文件解压到当前目录例:rar e test.rar注:用e解压的话,不仅原来的file1.txt和file2.txt被解压到当前目录,就连dir1里面的所有文件也被解压到当前目录下,不能保持压缩前的目录结构,如果想保持压缩前的目录结构,用x解压k 锁定文档例:rar k test.rar 锁定文档后,该文档就无法进行任何更新操作了r 修复文档例:rar r test.rar当rar文件有问题时,可以尝试用该命令进行修复(鬼知道有多少用)s 转换文档成自解压文档例:rar s test.rar会生成一个test.sfx的可执行文档,运行它的效果就相当于rar x test.rar,适合于向没有rar的用户传输文件t 检测文档例:rar t test.rar检测test.rar的完整性,一般压缩完大型文件准备传输前最好用这个命令来确保文件的正确性x 带路径解压文档中内容到当前目录例:rar x test.rar这样解压的话,dir1就会保持原来的目录结构以上就是rar的常用命令,一个rar操作只能有一个命令,而选项却可以有多个。