Rar
Rar
Rar
~~~~~~~~~~~~~
RAR 5.61 console version
~~~~~~~~~~~~~~~~~~~~~~~~
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Welcome to the RAR Archiver!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Introduction
~~~~~~~~~~~~
RAR supports only RAR format archives, which have .rar file name
extension by default. ZIP and other formats are not supported.
Even if you specify .zip extension when creating an archive, it will
still be in RAR format. Windows users may install WinRAR, which supports
more archive types including RAR and ZIP formats.
WinRAR provides both graphical user interface and command line mode.
While console RAR and GUI WinRAR have the similar command line syntax,
some differences exist. So it is recommended to use this rar.txt manual
for console RAR (rar.exe in case of Windows version) and winrar.chm
WinRAR help file for GUI WinRAR (winrar.exe).
Configuration file
~~~~~~~~~~~~~~~~~~
RAR and UnRAR for Unix read configuration information from .rarrc file
in a user's home directory (stored in HOME environment variable)
or in /etc directory.
RAR and UnRAR for Windows read configuration information from rar.ini file,
placed in the same directory as the rar.exe file.
For example:
switches=-m5 -s
For example:
switches_a=-m5 -s
switches_x=-o+
Environment variable
~~~~~~~~~~~~~~~~~~~~
RAR='-s -md1024'
export RAR
RAR will use this string as default parameters in the command line and
will create "solid" archives with 1024 KB sliding dictionary size.
Log file
~~~~~~~~
Normally masks placed nearer to the top of list have a higher priority,
but there is an exception from this rule. If rarfiles.lst contains such
two masks that all files matched by one mask are also matched by another,
that mask which matches a smaller subset of file names will have higher
priority regardless of its position in the list. For example, if you have
*.cpp and f*.cpp masks, f*.cpp has a higher priority, so the position of
'filename.cpp' will be chosen according to 'f*.cpp', not '*.cpp'.
Description
Listfiles are plain text files that contain names of files to process.
File names should start at the first column. It is possible to
put comments to the listfile after // characters. For example,
you may create backup.lst containing the following strings:
By default, console RAR uses the single byte encoding in list files,
but it can be redefined with -sc<charset>l switch.
You may specify both usual file names and list files in the same
command line. If neither files nor listfiles are specified,
then *.* is implied and RAR will process all files.
Examples:
1) add all *.hlp files from the current directory to
the archive help.rar:
Because no file names are specified, all files (*) are assumed.
The following command will add all files from the directory
Bitmaps and its subdirectories to the RAR archive Pictures.rar:
The following command will add all files from directory Bitmaps,
but not from its subdirectories, because switch -r is not
specified:
Examples:
rar c distrib.rar
Examples:
3) rar cw arc
Example:
i[i|c|h|t]=<string>
Find string in archives.
h - hexadecimal search;
t - use ANSI, Unicode and OEM character tables (Windows only);
Examples:
Example:
rar k final.rar
l[t[a],b]
List archive contents [technical [all], bare].
'lb' lists bare file names with path, one per line,
without any additional information.
You may use this command together with -inul switch to disable
all RAR messages and print only file data. It may be important
when you need to send a file to stdout for use in pipes.
Example:
RAR 4.x and RAR 5.0 archives use different recovery record
structure and algorithms.
RAR 4.x recovery sectors are 512 bytes long. If damaged area
is continuous, every sector helps to recover 512 bytes of
damaged information. This value may be lower in cases of
multiple damage. Maximum number of recovery sectors is 524288.
Both 4.x and 5.0 records are most efficient if data positions
in damaged archive are not shifted. If you copy an archive
from damaged media using some special software and if you have
a choice to fill damaged areas with zeroes or to cut out them
from copied file, filling with zeroes or any other value is
preferable, because it allows to preserve original data positions.
Still, even though it is not an optimal mode, both versions
of records attempt to repair data even in case of deletions
or insertions of reasonable size, when data positions were
shifted. RAR 5.0 recovery record handles deletions and insertions
more efficiently than RAR 4.x.
Example:
s[name] Convert archive to SFX. The archive is merged with a SFX module
(using a module in file default.sfx or specified in the switch).
In the Windows version default.sfx should be placed in the
same directory as the rar.exe, in Unix - in the user's
home directory, in /usr/lib or /usr/local/lib.
Examples:
rar t *
or for Unix:
rar t '*'
rar t -r *
or for Unix:
rar t -r '*'
v[t[a],b]
Verbosely list archive contents [technical [all], bare].
'vb' lists bare file names with path, one per line,
without any additional information.
Examples:
Example:
add all files from the current directory to the solid archive
'-StrangeName'
RAR a -s -- -StrangeName
If you specify -@, all such parameters found after this switch
will be considered as file names, not file lists.
If you specify -@+, all such parameters found after this switch
will be considered as file lists, not file names.
Example:
Example:
-ag[format]
Generate archive name using the current date and time.
Y - year
M - month
MMM - month name as text string (Jan, Feb, etc.)
W - a week number (a week starts with Monday)
A - day of week number (Monday is 1, Sunday - 7)
D - day of month
E - day of year
H - hours
M - minutes (treated as minutes if encountered after hours)
I - minutes (treated as minutes regardless of hours position)
S - seconds
N - archive number. RAR searches for already existing archive
with generated name and if found, increments the archive
number until generating a unique name. 'N' format character
is not supported when creating volumes.
When performing non-archiving operations like extracting,
RAR selects the existing archive preceding the first
unused name or sets N to 1 if no such archive exists.
Examples:
Example:
If -ed is used with 'm' command or -df switch, RAR will not
remove empty directories.
-ep1 Exclude base dir from names. Do not store or extract the path
entered in the command line. Ignored if path includes wildcards.
Examples:
cd tmp
rar a -r ..\test
cd ..
-ep2 Expand paths to full. Store full file paths (except the drive
letter and leading path separator) when archiving.
to restore it.
But be cautious and use -ep3 only if you are sure that
extracting archive does not contain any malicious files.
In other words, use it if you have created an archive yourself
or completely trust its author. This switch allows to overwrite
any file in any location on your computer including important
system files and should normally be used only for the purpose
of backup and restore.
-e[+]<attr>
Specifies file exclude or include attributes mask.
Examples:
Example:
-ht[b|c]
Select hash type [BLAKE2,CRC32] for file checksum.
Specify -htb switch for BLAKE2sp and -htc for CRC32 hash function.
Since CRC32 is the default algorithm, you may need -htc only to
override -htb in RAR configuration.
Example:
-id[c,d,p,q]
Disable messages.
-ieml[.][addr]
Send archive by email. Windows version only.
Example:
-ioff[n]
Turn PC off after completing an operation.
-iver Display the version number and quit. You can run just "RAR -iver".
-log[fmt][=name]
Write names to log file.
This switch allows to write archive and file names to specified
text file in archiving, extracting, deleting and listing commands.
Its behavior is defined by 'fmt' string, which can include one
or more of following characters:
Examples:
-ma[4|5]
Specify a version of archiving format.
-mc<par>
Set advanced compression parameters.
-mc[param1][:param2][module][+ or -]
A - audio compression;
C - true color (RGB) data compression;
D - delta compression;
E - x86 executable compression;
I - Intel Itanium executable compression;
T - text compression.
RAR 5.0 archive format supports only 'D' and 'E' values.
<Param2> is ignored.
Text compression:
Examples:
-md<n>[k,m,g]
Select the dictionary size.
For RAR 4.x archive format the dictionary size can be:
64 KB, 128 KB, 256 KB, 512 KB, 1 MB, 2 MB, 4 MB.
For RAR 5.0 archive format the dictionary size can be:
128 KB, 256 KB, 512 KB, 1 MB, 2 MB, 4 MB, 8 MB, 16 MB,
32 MB, 64 MB, 128 MB, 256 MB, 512 MB, 1 GB.
You can use 'k', 'm' and 'g' modifiers to specify the size
in kilo-, mega- and gigabytes, like -md64m for 64 MB dictionary.
If no modifier is specified, megabytes are assumed,
so -md64m and -md64 are equal.
Example:
-ms[list]
Specify file types to store.
7z, ace, arj, bz2, cab, gz, jpeg, jpg, lha, lz, lzh, mp3,
rar, taz, tgz, xz, z, zip, zipx
-mt<threads>
Set the number of threads.
This switch does not replace usual file masks, which still
need to be entered in the command line. It is an additional
filter limiting processed files only to those matching
the include mask specified in -n switch. It can help to
reduce the command line length sometimes.
This switch does not replace usual list files or file masks,
which still need to be entered in the command line.
It is an additional filter limiting processed files only to
those matching the include mask specified in -n switch.
Example:
You must not delete or rename the first hard link in archive
after the archive was created, because it will make extraction
of following links impossible. If you modify the first link,
all following links will also have the modified contents
after extracting. Extraction command must involve the first
hard link to create following hard links successfully.
-oi[0-4][:<minsize>]
Save identical files as references.
Switch -oi0 (or just -oi-) turns off identical file processing,
so such files are compressed as usual files. It can be used to
override another -oi value stored in RAR configuration.
Switches -oi1 and -oi2 are supported only by RAR 5.0 format.
Examples:
Supported both for RAR 4.x and RAR 5.0 archives in RAR for Unix
and only for RAR 5.0 archives in RAR for Windows.
While NTFS file system permits file names with trailing spaces
and dots, a lot of Windows programs fail to process such names
correctly. If this switch is not specified, RAR removes trailing
spaces and dots, if any, from file names when extracting.
Specify this switch if you need to extract such names as is.
-or Rename extracted files automatically if file with the same name
already exists. Renamed file will get the name like
'filename(N).txt', where 'filename.txt' is the original file
name and 'N' is a number starting from 1 and incrementing
if file exists.
This switch has meaning only for NTFS file system and allows
to save alternate data streams associated with a file.
You may need to specify it when archiving if you use software
storing data in alternative streams and wish to preserve
these streams.
Unix RAR version saves file owner and group when using
this switch.
Examples:
-qo[-|+]
Add quick open information [none|force]
To improve archive open speed and still not make the entire
archive dependent on a single damaged block, RAR 5.0 archives
can include an optional quick open record. Such record is
added to the end of archive and contains copies of file names
and other file information stored in a single continuous block
additionaly to normal file headers inside of archive.
Since the block is continuous, its contents can be read quickly,
without necessity to perform a lot of disk seek operations.
Every file header in this block is protected with a checksum.
If RAR detects that quick open information is damaged,
it resorts to reading individual headers from inside of archive,
so damage resistance is not lessened.
When used with the commands 'a', 'u', 'f', 'm' will process
files in all sub-directories as well as the current working
directory.
For example:
rar a -r- arc dirname
command will add only the empty 'dirname' directory and ignore
its contents. Following command:
-r0 Similar to -r, but when used with the commands 'a', 'u', 'f',
'm' will recurse into subdirectories only for those file masks,
which include wildcard characters '*' and '?'.
This switch works only for file names. Directory names without
a file name part, such as 'dirname', are not affected by -r0
and their contents is added to archive completely unless -r-
switch is specified.
Example:
add *.doc files from the current directory and its subdirectories
and readme.txt only from the current directory to docs.rar
archive. In case of usual -r switch, RAR would search for
readme.txt in subdirectories too.
-ri<p>[:<s>]
Set priority and sleep time. Available only in RAR for Windows.
This switch regulates system load by RAR in multitasking
environment. Possible task priority <p> values are 0 - 15.
Example:
-rr[N] Add data recovery record. This switch is used when creating
or modifying an archive to add a data recovery record to
the archive. See the 'rr[N]' command description for details.
Example:
-sc<charset>[objects]
Specify the character set.
U - Unicode UTF-16;
F - Unicode UTF-8;
A - the native single byte encoding, which is ANSI
for Windows version;
O - OEM (DOS) encoding. Windows version only.
Examples:
-sfx[name]
Create SFX archives. If this switch is used when creating a new
archive, a Self-Extracting archive (using a module in file
default.sfx or specified in the switch) would be created.
In the Windows version default.sfx should be placed in the
same directory as the rar.exe, in Unix - in the user's
home directory, in /usr/lib or /usr/local/lib.
Example:
-si[name]
Read data from stdin (standard input), when creating
an archive. Optional 'name' parameter allows to specify
a file name of compressed stdin data in the created
archive. If this parameter is missing, the name will be
set to 'stdin'.
Example:
-sl<size>
Process only those files, which size is less than
specified in <size> parameter of this switch.
Parameter <size> must be specified in bytes.
-sm<size>
Process only those files, which size is more than
specified in <size> parameter of this switch.
Parameter <size> must be specified in bytes.
This switch forces RAR to ignore packed data size and attempt
to reset statistics for volumes of any size. It decreases
compression, but increases chances to extract a part of data
if one of several solid volumes in a volume set was lost
or damaged.
-ta<date>
Process only files modified after the specified date.
Format of the date string is YYYYMMDDHHMMSS.
It is allowed to insert separators like '-' or ':' to
the date string and omit trailing fields. For example,
the following switch is correct: -ta2001-11-20
Internally it will be expanded to -ta20011120000000
and treated as "files modified after 0 hour 0 minutes
0 seconds of 20 November 2001".
-tb<date>
Process only files modified before the specified date.
Format of the switch is the same as -ta<date>.
-tk Keep original archive date. Prevents RAR from modifying the
archive date when changing an archive.
-tl Set archive time to newest file. Forces RAR to set the date of a
changed archive to the date of the newest file in the archive.
-tn<time>
Process files newer than the specified time period. Format
of the time string is:
[<ndays>d][<nhours>h][<nminutes>m][<nseconds>s]
-to<time>
Process files older than the specified time period. Format
of the switch is the same as -tn<time>.
-ts[m|c|a][+|-|1]
Save or restore file time (modification, creation, access).
Use -tsm to save the file modification time, -tsc for creation
time and -tsa for last access time. Multiple -ts switches,
such as -tsc -tsa, are allowed. If 'm', 'c' or 'a' are not
specified, all three file times are assumed.
By default RAR sets only the modification time for extracted files,
even if archive contains other times. Use -ts or -ts+ when
unpacking to set all three times, -tsc and -tsa to set
creation and last access times, -tsm- or -ts- to set the current
system time instead of modification time stored in archive.
Examples:
-v<size>[k|b|f|m|M|g|G]
Create volumes with size=<size>*1000 [*1024 | *1].
By default this switch uses <size> as thousands (1000) of bytes
(not 1024 x bytes). You may also enter the size in kilobytes
using the symbol 'k', in bytes using the symbol 'b',
megabytes - 'm', millions of bytes - 'M', gigabytes - 'g',
billions (milliards) of bytes - 'G' or select one of several
predefined values using the symbol 'f' following the numerical
value. Predefined values can be 360, 720, 1200, 1440 or 2880
and replaced with corresponding floppy disk size.
Insert the disk with the correct volume and press any key.
Example:
-w<p> Assign work directory as <p>. This switch may be used to assign
the directory for temporary files.
If you know the exact path to file, you can use "path\filename"
syntax to exclude only this copy of "filename". If you use
-xpath\filename syntax when unpacking an archive, "path" must be
the path inside of archive, not the file path on the disk after
unpacking.
Examples:
-x@<lf> Exclude files listed in the specified list file. If you use -x@
without the list file name parameter, it will read file names
from stdin.
Example:
-z[file]
Read archive comment from file <file>.
Limitations
~~~~~~~~~~~
Command limitations:
Exit values
~~~~~~~~~~~
Code Description
0 Successful operation.
1 Non fatal error(s) occurred.
2 A fatal error occurred.
3 Invalid checksum. Data is damaged.
4 Attempt to modify an archive locked by 'k' command.
5 Write error.
6 File open error.
7 Wrong command line option.
8 Not enough memory.
9 File create error
10 No files matching the specified mask and options were found.
11 Wrong password.
255 User stopped the process.
Glossary
~~~~~~~~
Copyrights