1.说明
要安装一个.rar
格式的应用,上传 Linux 系统后发现没有解压工具,上网搜索后开始一波三折的旅程。
2.安装
2.1 跳坑
# 有小伙伴分享安装方法
yum install rar
# 安装后根本无法使用 unrar 命令
2.2 一波三折
WinRAR 官网下载 这里有各种操作系统不同语言的版本,下载注意【坑1️⃣】:
# 查询系统版本信息是 x86_64
rpm -qi centos-release
Name : centos-release
Version : 7
Release : 9.2009.1.el7.centos
Architecture: x86_64
查询系统版本信息是x86_64
是64 bit 的 x86 指令集系统
如果点击RAR 6.11 for Linux x86
下载到的rarlinux-x32-611.tar
安装包是32 bit
的,安装后使用报错:
-bash: /usr/local/bin/rar: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
重新下载64 bit
的安装包rarlinux-x64-611.tar
:
# 解压 安装
tar -zxvf rarlinux-x32-611.tar
cd rar
make
make install
3.使用
【坑2️⃣】安装成功后用了小伙伴举例的解压命令:
# 怎知道这个是 without archived paths
unrar e xxx.rar
# 带路径的用
unrar x xxx.rar
# 仅贴出两个参数
UNRAR 6.11 freeware Copyright (c) 1993-2022 Alexander Roshal
Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...><@listfiles...> <path_to_extract\>
<Commands>e Extract files without archived pathsx Extract files with full path
4.更多
4.1 压缩命令
RAR 6.11 Copyright (c) 1993-2022 Alexander Roshal 3 Mar 2022
Trial version Type 'rar -?' for helpUsage: rar <command> -<switch 1> -<switch N> <archive> <files...><@listfiles...> <path_to_extract\><Commands>a Add files to archivec Add archive commentch Change archive parameterscw Write archive comment to filed Delete files from archivee Extract files without archived pathsf Freshen files in archivei[par]=<str> Find string in archivesk Lock archivel[t[a],b] List archive contents [technical[all], bare]m[f] Move to archive [files only]p Print file to stdoutr Repair archiverc Reconstruct missing volumesrn Rename archived filesrr[N] Add data recovery recordrv[N] Create recovery volumess[name|-] Convert archive to or from SFXt Test archive filesu Update files in archivev[t[a],b] Verbosely list archive contents [technical[all],bare]x Extract files with full path<Switches>- Stop switches scanning@[+] Disable [enable] file listsad[1,2] Alternate destination pathag[format] Generate archive name using the current dateai Ignore file attributesap<path> Set path inside archiveas Synchronize archive contentsc- Disable comments showcfg- Disable read configurationcl Convert names to lower casecu Convert names to upper casedf Delete files after archivingdh Open shared filesds Disable name sort for solid archivedw Wipe files after archivinge[+]<attr> Set file exclude and include attributesed Do not add empty directoriesep Exclude paths from namesep1 Exclude base directory from namesep3 Expand paths to full including the drive letterep4<path> Exclude the path prefix from namesf Freshen fileshp[password] Encrypt both file data and headersht[b|c] Select hash type [BLAKE2,CRC32] for file checksumid[c,d,n,p,q] Display or disable messagesierr Send all messages to stderrilog[name] Log errors to fileinul Disable all messagesisnd[-] Control notification soundsiver Display the version numberk Lock archivekb Keep broken extracted fileslog[f][=name] Write names to log filem<0..5> Set compression level (0-store...3-default...5-maximal)ma[4|5] Specify a version of archiving formatmc<par> Set advanced compression parametersmd<n>[k,m,g] Dictionary size in KB, MB or GBme[par] Set encryption parametersms[ext;ext] Specify file types to storemt<threads> Set the number of threadsn<file> Additionally filter included filesn@ Read additional filter masks from stdinn@<list> Read additional filter masks from list fileo[+|-] Set the overwrite modeoh Save hard links as the link instead of the fileoi[0-4][:min] Save identical files as referencesol[a] Process symbolic links as the link [absolute paths]op<path> Set the output path for extracted filesor Rename files automaticallyow Save or restore file owner and groupp[password] Set passwordqo[-|+] Add quick open information [none|force]r Recurse subdirectoriesr- Disable recursionr0 Recurse subdirectories for wildcard names onlyrr[N] Add data recovery recordrv[N] Create recovery volumess[<N>,v[-],e] Create solid archives- Disable solid archivingsc<chr>[obj] Specify the character setsfx[name] Create SFX archivesi[name] Read data from standard input (stdin)sl<size> Process files with size less than specifiedsm<size> Process files with size more than specifiedt Test files after archivingta[mcao]<d> Process files modified after <d> YYYYMMDDHHMMSS datetb[mcao]<d> Process files modified before <d> YYYYMMDDHHMMSS datetk Keep original archive timetl Set archive time to latest filetn[mcao]<t> Process files newer than <t> timeto[mcao]<t> Process files older than <t> timets[m,c,a,p] Save or restore time (modification, creation, access, preserve)u Update filesv<size>[k,b] Create volumes with size=<size>*1000 [*1024, *1]ver[n] File version controlvn Use the old style volume naming schemevp Pause before each volumew<path> Assign work directoryx<file> Exclude specified filex@ Read file names to exclude from stdinx@<list> Exclude files listed in specified list filey Assume Yes on all queriesz[file] Read archive comment from file
4.2 解压命令
UNRAR 6.11 freeware Copyright (c) 1993-2022 Alexander RoshalUsage: unrar <command> -<switch 1> -<switch N> <archive> <files...><@listfiles...> <path_to_extract\><Commands>e Extract files without archived pathsl[t[a],b] List archive contents [technical[all], bare]p Print file to stdoutt Test archive filesv[t[a],b] Verbosely list archive contents [technical[all],bare]x Extract files with full path<Switches>- Stop switches scanning@[+] Disable [enable] file listsad[1,2] Alternate destination pathag[format] Generate archive name using the current dateai Ignore file attributesap<path> Set path inside archivec- Disable comments showcfg- Disable read configurationcl Convert names to lower casecu Convert names to upper casedh Open shared filesep Exclude paths from namesep3 Expand paths to full including the drive letterep4<path> Exclude the path prefix from namesf Freshen filesid[c,d,n,p,q] Display or disable messagesierr Send all messages to stderrinul Disable all messageskb Keep broken extracted filesme[par] Set encryption parametersn<file> Additionally filter included filesn@ Read additional filter masks from stdinn@<list> Read additional filter masks from list fileo[+|-] Set the overwrite modeol[a] Process symbolic links as the link [absolute paths]op<path> Set the output path for extracted filesor Rename files automaticallyow Save or restore file owner and groupp[password] Set passwordr Recurse subdirectoriessc<chr>[obj] Specify the character setsi[name] Read data from standard input (stdin)sl<size> Process files with size less than specifiedsm<size> Process files with size more than specifiedta[mcao]<d> Process files modified after <d> YYYYMMDDHHMMSS datetb[mcao]<d> Process files modified before <d> YYYYMMDDHHMMSS datetn[mcao]<t> Process files newer than <t> timeto[mcao]<t> Process files older than <t> timets[m,c,a,p] Save or restore time (modification, creation, access, preserve)u Update filesv List all volumesver[n] File version controlvp Pause before each volumex<file> Exclude specified filex@ Read file names to exclude from stdinx@<list> Exclude files listed in specified list filey Assume Yes on all queries
5.总结
首先是寻求小伙伴儿的帮助,然后要去官网,去官网,去官网,如果踩坑再需求小伙伴儿的帮助 😄