We often download some compressed files online, so compression and decompression have become something we often do. In the Linux system, we can use the rar and unrar commands to compress and decompress. Today, the editor of Huajun will show you how to install Linux. rar and unrar commands, carefully selected content. I hope everyone will support and share it more. If you like it, hurry up and get it! .
Installation method:
Take version 3.8.0 as an example. If it is a 64-bit platform, execute the following command, or you can go to the official website:) to download the latest version:
wget http://www.rarlab.com/rar/rarlinux-x64-4.2.0.tar.gz
rar software does not need to be installed, it can be directly extracted to /usr/local. The following operations require root permissions.
#tar zxvf rarlinux-x64-4.2.0.tar.gz -C /usr/local
At this time, there will be rar command and unrar command under /usr/local/rar. A connection can be created under /usr/local/bin
#ln -s /usr/local/rar/rar /usr/local/bin/rar
#ln -s /usr/local/rar/unrar /usr/local/bin/unrar
Usage: How to use rar command
a Add files to compressed archive
c Add compressed archive comments (the maximum size of the comments cannot exceed 62000 bytes)
cf adds file comments (displays file comments when using the 'v' parameter, the maximum cannot exceed 32767 bytes)
ch changes compressed file parameters
cw writes file comments to the specified file
d Delete files from archive
e Unzip the file to the current directory (without creating any subdirectories)
f Refresh the files in the archive (update these files with changes since they were packed, do not add new ones to the compressed archive)
i[par]= Find specific characters in a file
k locks the archive (any commands that attempt to change the contents of the compressed archive will be ignored)
l[t,b] list files [technical, bare]
m[f] Move to compressed archive [files only]
p print file to standard output
r Repair compressed archive
rc Rebuild lost volumes
rn Rename files in a compressed archive
rr[N] Add data recovery record
rv[N] Create recovery volume
s[name|-] Conversion between compressed archives and SFX (self-extracting archives)
t test compressed archive file
u Update files in compressed archive
v[t,b] List detailed information of compressed files [technical,bare]
x extract to full path
Example: rar a anaconda-ks.cfg.rar anaconda-ks.cfg
Use of decompression command unrar:
$unrar –help
Usage: unrar - -
<@listfiles…>
<command>
e Unzip the file to the current directory
l[t,b] List compressed file information [technical, bare]
p print file to standard output
t test compression
v[t,b] List detailed information of compressed files [technical,bare]
x Extract the file to the full path
[root@localhost ~]# unrar e anaconda-ks.cfg.rar /home/
Commonly used rar commands:
rar x centos.rar //Extract centos.rar to the current directory
rar centos.rar ./piaoyi.org/ //Package the piaoyi.org directory into centos.rar
However, Piaoyi recommends that you use zip compression and decompression, because zip usually comes with the Linux system:
1.zip
zip -r myfile.zip ./web
Compress all files and folders under the web in the current directory into the myfile.zip file. -r means recursively compress all files in the subdirectory.
2.unzip
unzip -o -d /home/sunny myfile.zip
Extract the myfile.zip file to /home/sunny/
-o: Overwrite the file without prompting;
-d:-d /home/sunny specifies to decompress the file to the /home/sunny directory;
Analysis of common error causes:
1. If the following problem occurs when running the command rar
rar: /lib/i686/nosegneg/libc.so.6: version `GLIBC_2.7' not found (required by rar)
Solution:
cp rar_static /usr/local/bin/rar
2. An error occurs when using rar
bash: /usr/local/bin/rar: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Because 32-bit programs are installed on 64-bit systems, the solution is:
yum install glibc.i686
3. After reinstalling glibc.i686, there are still errors similar to the following:
error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
Continue to install the package:
yum install libstdc++.so.6
Supplementary foreign sources:
Install Rar/Unrar centos 6
for 64 bits
install unrar centos x64
#wget http://pkgs.repoforge.org/unrar/unrar-4.0.7-1.el6.rf.x86_64.rpm
#rpm -Uvh unrar-4.0.7-1.el6.rf.x86_64.rpm
install rar centos x64
#wget http://pkgs.repoforge.org/rar/rar-3.8.0-1.el6.rf.x86_64.rpm
#rpm -Uvh rar-3.8.0-1.el6.rf.x86_64.rpm
for 32 bits
install unrar centos 32
#wget http://pkgs.repoforge.org/unrar/unrar-4.0.7-1.el6.rf.i686.rpm
#rpm -Uvh unrar-4.0.7-1.el6.rf.i686.rpm
install rar centos 32
#wget http://pkgs.repoforge.org/rar/rar-3.8.0-1.el6.rf.i686.rpm
#rpm -Uvh rar-3.8.0-1.el6.rf.i686.rpm
The above is the editor’s summary of how to install rar and unrar commands in Linux systems. Users who still don’t know how to install these two commands can refer to the above steps for installation.