最新消息:20181230 VPS服务器已从Linode换到腾讯云香港,主题仍用朋友推荐的大前端D8

【已解决】CentOS中去解压7zip格式的7z文件

CentOS crifan 96浏览 0评论

折腾:

【记录】crifan.com的WordPress网站从Linode搬家到腾讯云香港服务器

期间,需要去腾讯云香港CVM服务器中CentOS 7中去解压7z文件:

<code>[root@VM_0_11_centos wwwroot]# ls -lh
total 8.5G
drwxr-xr-x 3 www  www  4.0K Dec 25 21:17 default
drwxr-xr-x 2 www  www  4.0K Dec 25 21:41 www.crifan.com
-rw-r--r-- 1 root root 8.5G Dec 26 22:20 www.crifan.com_allFiles_20181225.7z
</code>

centos 7z uncompress

tar – Extract 7z files with standard linux tools? – Super User

7zip File: How to Uncompress 7z files on Ubuntu, Debian, Fedora

用e参数

<code>[root@VM_0_11_centos wwwroot]# 7za e www.crifan.com_allFiles_20181225.7z 
-bash: 7za: command not found
</code>

7zip – How can I uncompress a *.7z file? – Ask Ubuntu

用7z x

结果才想起来,还没安装7z呢。。。

参考之前自己的:

【记录】CentOS下用7zip压缩文件去备份网站

去安装

https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2/download

-》

https://nchc.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2

去服务器中下载

<code>[root@VM_0_11_centos tool]# tar xvf p7zip_16.02_src_all.tar.bz2
[root@VM_0_11_centos tool]# ll -lh
total 4.1M
drwx--S--- 11 www  ftp  4.0K Jul 14  2016 p7zip_16.02
-rw-r--r--  1 root root 4.1M Jul 14  2016 p7zip_16.02_src_all.tar.bz2
cd p7zip_16.02
make &amp;&amp; make install
...ake[1]: Leaving directory `/data/wwwroot/tool/p7zip_16.02/CPP/7zip/Bundles/Alone'
./install.sh /usr/local/bin /usr/local/lib/p7zip /usr/local/man /usr/local/share/doc/p7zip 
- installing /usr/local/bin/7za
- installing /usr/local/man/man1/7z.1
- installing /usr/local/man/man1/7za.1
- installing /usr/local/man/man1/7zr.1
- installing /usr/local/share/doc/p7zip/README
- installing /usr/local/share/doc/p7zip/ChangeLog
- installing HTML help in /usr/local/share/doc/p7zip/DOC
</code>

看看版本:

<code>[root@VM_0_11_centos p7zip_16.02]# which 7za
/usr/local/bin/7za
[root@VM_0_11_centos p7zip_16.02]# 7za --version


Command Line Error:
Unknown switch:
--version
[root@VM_0_11_centos p7zip_16.02]# 7za --help

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs x64)

Usage: 7za &lt;command&gt; [&lt;switches&gt;...] &lt;archive_name&gt; [&lt;file_names&gt;...]
       [&lt;@listfiles...&gt;]

&lt;Commands&gt;
  a : Add files to archive
  b : Benchmark
  d : Delete files from archive
  e : Extract files from archive (without using directory names)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

&lt;Switches&gt;
  -- : Stop switches parsing
  -ai[r[-|0]]{@listfile|!wildcard} : Include archives
  -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
  -ao{a|s|t|u} : set Overwrite mode
  -an : disable archive_name field
  -bb[0-3] : set output log level
  -bd : disable progress indicator
  -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
  -bt : show execution time statistics
  -i[r[-|0]]{@listfile|!wildcard} : Include filenames
  -m{Parameters} : set compression Method
    -mmt[N] : set number of CPU threads
  -o{Directory} : set Output directory
  -p{Password} : set Password
  -r[-|0] : Recurse subdirectories
  -sa{a|e|s} : set Archive name mode
  -scc{UTF-8|WIN|DOS} : set charset for for console input/output
  -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
  -scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
  -sdel : delete files after compression
  -seml[.] : send archive by email
  -sfx[{name}] : Create SFX archive
  -si[{name}] : read data from stdin
  -slp : set Large Pages mode
  -slt : show technical information for l (List) command
  -snh : store hard links as links
  -snl : store symbolic links as links
  -sni : store NT security information
  -sns[-] : store NTFS alternate streams
  -so : write data to stdout
  -spd : disable wildcard matching for file names
  -spe : eliminate duplication of root folder for extract command
  -spf : use fully qualified file paths
  -ssc[-] : set sensitive case mode
  -ssw : compress shared files
  -stl : set archive timestamp from the most recently modified file
  -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
  -stx{Type} : exclude archive type
  -t{Type} : Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
  -v{Size}[b|k|m|g] : Create volumes
  -w[{path}] : assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]{@listfile|!wildcard} : eXclude filenames
  -y : assume Yes on all queries
</code>

可见:

  x : eXtract files with full paths

<code>7za x www.crifan.com_allFiles_20181225.7z
</code>

去解压:

【总结】

此处去CentOS要解压7z,需要先去安装:

先用浏览器打开:

https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2/download

会自动下载,得到下载地址,然后去服务器中用wget下载:

<code>wget https://nchc.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2
</code>

解压:

<code>tar xvf p7zip_16.02_src_all.tar.bz2
</code>

安装

<code>cd p7zip_16.02
make &amp;&amp; make install
</code>

确认已安装:

<code>which 7za
7za --help
</code>

然后再去解压7z

<code>7za x www.crifan.com_allFiles_20181225.7z
</code>

【后记】

How to Extract 7zip files in CentOS 7 | Unzip 7z CentOS

<code>sudo yum install epel-release
sudo yum install p7zip
7za x file.7z
</code>

有空去试试。

转载请注明:在路上 » 【已解决】CentOS中去解压7zip格式的7z文件

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
55 queries in 0.109 seconds, using 10.00MB memory