Linux under the rar file extraction method

  • 2020-10-07 18:58:51
  • OfStack

The rar compressed file is downloaded from the Internet. In linux, we need to uncompress it. At this time, we need to install rar related files to uncompress it.

1. Download

We go to the rarlab website and download it rar for linux x64

Unzip using tar (*.tar using tar? xvf?)


Downloads tar -xvf rarlinux-x64-5.6.0.tar.gz 

3. Enter folder make (administrator privileges required)


rar cat makefile 
###################################################################
# Installing RAR executables, configuration files and SFX modules #
# to appropriate directories                   #
###################################################################
PREFIX=/usr/local
install:
  mkdir -p $(PREFIX)/bin
  mkdir -p $(PREFIX)/lib
  cp rar unrar $(PREFIX)/bin
  cp rarfiles.lst /etc
  cp default.sfx $(PREFIX)/lib%   

If you don't do make, you need to execute the command in the same folder as the command, or add the folder to the environment variable.

3. Finally, you can use unrar for decompression and rar for compression.

 ~ unrar x [file]

We can type unrar directly to see the help


 rar ./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

Other decompression commands:

1, *.tar using tar? xvf decompression
2. *.gz extract with ES44en-ES45en or gunzip
3. *.tar.gz and *.tgz. tar? xzf
4. *.bz2 extract with bzip2-ES56en or bunzip2
5, *.tar.bz2? tar
6. *.Z extract with uncompress
7. *.tar. xZf
8, *.rar. unrar e
9. *.zip Extract with unzip

conclusion


Related articles: