Linux系统不支持rar压缩文件解压,所以要先安装在进行解压。
需要先装make哦,如果没安装需要安装一下呦
1,首先要在tools文件夹下面进行安装,没有就mkdir好了
[root@izuf6bgrqpp01oqg9andmhz ~]# cd /usr/local/ [root@izuf6bgrqpp01oqg9andmhz local]# ll total 52 drwxr-xr-x 8 root root 4096 Nov 6 05:17 aegis drwxr-xr-x. 2 root root 4096 Nov 5 2016 bin drwxr-xr-x 10 root root 4096 Nov 5 16:19 cloudmonitor drwxr-xr-x. 2 root root 4096 Nov 5 2016 etc drwxr-xr-x. 2 root root 4096 Nov 5 2016 games drwxr-xr-x. 2 root root 4096 Nov 5 2016 include drwxr-xr-x. 2 root root 4096 Nov 5 2016 lib drwxr-xr-x. 2 root root 4096 Nov 5 2016 lib64 drwxr-xr-x. 2 root root 4096 Nov 5 2016 libexec drwxr-xr-x 10 root root 4096 Nov 6 10:04 openresty drwxr-xr-x. 2 root root 4096 Nov 5 2016 sbin drwxr-xr-x. 6 root root 4096 Nov 5 16:17 share drwxr-xr-x. 2 root root 4096 Nov 5 16:21 src [root@izuf6bgrqpp01oqg9andmhz local]# mkdir tools [root@izuf6bgrqpp01oqg9andmhz local]# cd tools/
2,然后去下载文件喽
[root@izuf6bgrqpp01oqg9andmhz tools]# wget https://www.rarlab.com/rar/rarlinux-x64-5.6.0.tar.gz
完蛋了我的出错了
[root@izuf6bgrqpp01oqg9andmhz tools]# wget https://www.rarlab.com/rar/rarlinux-x64-5.6.0.tar.gz --2021-11-12 14:35:48-- https://www.rarlab.com/rar/rarlinux-x64-5.6.0.tar.gz Resolving www.rarlab.com (www.rarlab.com)... 51.195.68.162 Connecting to www.rarlab.com (www.rarlab.com)|51.195.68.162|:443... connected. ERROR: cannot verify www.rarlab.com's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’: Issued certificate has expired. To connect to www.rarlab.com insecurely, use `--no-check-certificate'.
问题不大 自己下载一个 使用ftp传上去 下载地址 链接
3,然后运行命令 解压 tra.gz文件
[root@izuf6bgrqpp01oqg9andmhz tools]# tar -xvf linuxrar-5.6.tar.gz
4,进入rar文件夹 开始make(也就是复制文件)
[root@izuf6bgrqpp01oqg9andmhz tools]# cd rar [root@izuf6bgrqpp01oqg9andmhz rar]# make 'mkdir -p /usr/local/bin mkdir -p /usr/local/lib cp rar unrar /usr/local/bin cp rarfiles.lst /etc cp default.sfx /usr/local/lib [root@izuf6bgrqpp01oqg9andmhz rar]# make install mkdir -p /usr/local/bin mkdir -p /usr/local/lib cp rar unrar /usr/local/bin cp rarfiles.lst /etc cp default.sfx /usr/local/lib
5,进入你需要解压文件的文件夹,开始解压文件
[root@izuf6bgrqpp01oqg9andmhz rar]# cd /xxx/xxx/x/xxx/xxxx [root@izuf6bgrqpp01oqg9andmhz myhunli]# rar x fff.rar
上面这是解压到当前文件夹
[root@izuf6bgrqpp01oqg9andmhz myhunli]# rar x sss.rar /usr/xxx/xxx/xxx/xxx/aaa
上面这是解压到指定文件夹
6,其他的解压方式
如果不使用x还有e x是带有文件夹结构的 e是所有文件直接解压到根目录
sss.rar 里面结构是 sss.rar/sss/aaa.txt sss.rar/sss/xxx/xxx.txt 请欣赏结果
[root@izuf6bgrqpp01oqg9andmhz myhunli]# rar e sss.rar RAR 5.60 Copyright (c) 1993-2018 Alexander Roshal 24 Jun 2018 Trial version Type 'rar -?' for help Extracting from sss.rar Extracting aaa.txt OK Extracting xxx.txt OK All OK [root@izuf6bgrqpp01oqg9andmhz myhunli]# ll total 3042688 -rw-r--r-- 1 root root 0 Nov 12 15:33 aaa.txt -rw-r--r-- 1 root root 3115692736 Nov 12 13:46 fff.rar drwxr-xr-x 6 root root 4096 Nov 12 14:47 MyHunli -rw-r--r-- 1 root root 196 Nov 12 15:44 sss.rar -rw-r--r-- 1 root root 0 Nov 12 15:44 xxx.txt [root@izuf6bgrqpp01oqg9andmhz myhunli]#
[root@izuf6bgrqpp01oqg9andmhz myhunli]# rar e sss.rar /xxx/xxx/xxx/xxx/aaa RAR 5.60 Copyright (c) 1993-2018 Alexander Roshal 24 Jun 2018 Trial version Type 'rar -?' for help Extracting from sss.rar Extracting /xxx/xxx/xxx/xxx/aaa/aaa.txt OK Extracting /xxx/xxx/xxx/xxx/aaa/xxx.txt OK All OK [root@izuf6bgrqpp01oqg9andmhz myhunli]# ll total 3042688 drwxr-xr-x 2 root root 4096 Nov 12 15:47 aaa -rw-r--r-- 1 root root 3115692736 Nov 12 13:46 fff.rar drwxr-xr-x 6 root root 4096 Nov 12 14:47 MyHunli -rw-r--r-- 1 root root 196 Nov 12 15:44 sss.rar [root@izuf6bgrqpp01oqg9andmhz myhunli]# cd aaa/ [root@izuf6bgrqpp01oqg9andmhz aaa]# ll total 0 -rw-r--r-- 1 root root 0 Nov 12 15:33 aaa.txt -rw-r--r-- 1 root root 0 Nov 12 15:44 xxx.txt
7,剩余其他的解压方式 键入rar或者unrar就可以查看
[root@izuf6bgrqpp01oqg9andmhz aaa]# rar RAR 5.60 Copyright (c) 1993-2018 Alexander Roshal 24 Jun 2018 Trial version Type 'rar -?' for help Usage: rar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract\> <Commands> a Add files to archive c Add archive comment ch Change archive parameters cw Write archive comment to file d Delete files from archive e Extract files without archived paths f Freshen files in archive i[par]=<str> Find string in archives k Lock archive l[t[a],b] List archive contents [technical[all], bare] m[f] Move to archive [files only] p Print file to stdout r Repair archive rc Reconstruct missing volumes rn Rename archived files rr[N] Add data recovery record rv[N] Create recovery volumes s[name|-] Convert archive to or from SFX t Test archive files u Update files in archive v[t[a],b] Verbosely list archive contents [technical[all],bare] x Extract files with full path <Switches> - Stop switches scanning @[+] Disable [enable] file lists ad Append archive name to destination path ag[format] Generate archive name using the current date ai Ignore file attributes ap<path> Set path inside archive as Synchronize archive contents c- Disable comments show cfg- Disable read configuration cl Convert names to lower case cu Convert names to upper case df Delete files after archiving dh Open shared files ds Disable name sort for solid archive dw Wipe files after archiving e[+]<attr> Set file exclude and include attributes ed Do not add empty directories en Do not put 'end of archive' block ep Exclude paths from names ep1 Exclude base directory from names ep3 Expand paths to full including the drive letter f Freshen files hp[password] Encrypt both file data and headers ht[b|c] Select hash type [BLAKE2,CRC32] for file checksum id[c,d,p,q] Disable messages ierr Send all messages to stderr ilog[name] Log errors to file inul Disable all messages isnd Enable sound iver Display the version number k Lock archive kb Keep broken extracted files log[f][=name] Write names to log file m<0..5> Set compression level (0-store...3-default...5-maximal) ma[4|5] Specify a version of archiving format mc<par> Set advanced compression parameters md<n>[k,m,g] Dictionary size in KB, MB or GB ms[ext;ext] Specify file types to store mt<threads> Set the number of threads n<file> Additionally filter included files n@ Read additional filter masks from stdin n@<list> Read additional filter masks from list file o[+|-] Set the overwrite mode oh Save hard links as the link instead of the file oi[0-4][:min] Save identical files as references ol[a] Process symbolic links as the link [absolute paths] or Rename files automatically ow Save or restore file owner and group p[password] Set password p- Do not query password qo[-|+] Add quick open information [none|force] r Recurse subdirectories r- Disable recursion r0 Recurse subdirectories for wildcard names only rr[N] Add data recovery record rv[N] Create recovery volumes s[<N>,v[-],e] Create solid archive s- Disable solid archiving sc<chr>[obj] Specify the character set sfx[name] Create SFX archive si[name] Read data from standard input (stdin) sl<size> Process files with size less than specified sm<size> Process files with size more than specified t Test files after archiving ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format tk Keep original archive time tl Set archive time to latest file tn<time> Process files newer than <time> to<time> Process files older than <time> ts[m|c|a] Save or restore file time (modification, creation, access) u Update files v<size>[k,b] Create volumes with size=<size>*1000 [*1024, *1] ver[n] File version control vn Use the old style volume naming scheme vp Pause before each volume w<path> Assign work directory x<file> Exclude specified file x@ Read file names to exclude from stdin x@<list> Exclude files listed in specified list file y Assume Yes on all queries z[file] Read archive comment from file [root@izuf6bgrqpp01oqg9andmhz aaa]# unrar UNRAR 5.60 freeware Copyright (c) 1993-2018 Alexander Roshal Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract\> <Commands> e Extract files without archived paths l[t[a],b] List archive contents [technical[all], bare] p Print file to stdout t Test archive files v[t[a],b] Verbosely list archive contents [technical[all],bare] x Extract files with full path <Switches> - Stop switches scanning @[+] Disable [enable] file lists ad Append archive name to destination path ag[format] Generate archive name using the current date ai Ignore file attributes ap<path> Set path inside archive c- Disable comments show cfg- Disable read configuration cl Convert names to lower case cu Convert names to upper case dh Open shared files ep Exclude paths from names ep3 Expand paths to full including the drive letter f Freshen files id[c,d,p,q] Disable messages ierr Send all messages to stderr inul Disable all messages kb Keep broken extracted files n<file> Additionally filter included files n@ Read additional filter masks from stdin n@<list> Read additional filter masks from list file o[+|-] Set the overwrite mode ol[a] Process symbolic links as the link [absolute paths] or Rename files automatically ow Save or restore file owner and group p[password] Set password p- Do not query password r Recurse subdirectories sc<chr>[obj] Specify the character set sl<size> Process files with size less than specified sm<size> Process files with size more than specified ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format tn<time> Process files newer than <time> to<time> Process files older than <time> ts[m|c|a] Save or restore file time (modification, creation, access) u Update files v List all volumes ver[n] File version control vp Pause before each volume x<file> Exclude specified file x@ Read file names to exclude from stdin x@<list> Exclude files listed in specified list file y Assume Yes on all queries