Rar Command Usage Examples

How to rar a single file ?

syntax: rar a {.rar file-name} {file-name}

# rar a syslog.rar /var/log/syslog
	
RAR 3.90 beta 2   Copyright (c) 1993-2009
Alexander Roshal   3 Jun 2009
Shareware version         Type RAR -? for help
Evaluation copy. Please register.
	
Creating archive syslog.rar
Adding    /var/log/syslog   OK 
Done

How to rar multiple files ?

syntax: rar a {.rar file-name} {file-names}

# rar a var-log-cups.rar /var/log/cups/*
	
	RAR 3.90 beta 2   Copyright (c) 1993-2009
    Alexander Roshal   3 Jun 2009
	Shareware version         Type RAR -? for help
	Evaluation copy. Please register.
	
	Creating archive var-log-cups.rar
	Adding    /var/log/cups/access_log OK
	Adding    /var/log/cups/access_log.1.gz OK 
	Adding    /var/log/cups/access_log.2.gz OK 
	Adding    /var/log/cups/error_log OK
	Adding    /var/log/cups/error_log.1.gz OK
	Adding    /var/log/cups/error_log.2.gz OK
	Done

You can also use the following method to rar multiple files.

# rar a -r var-log-cups.rar /var/log/cups/

How to unrar a *.rar compressed file ?

syntax: unrar e {.rar file-name}

# unrar e var-log-cups.rar 
	
	UNRAR 3.90 beta 2 freeware Copyright (c) 1993-2009 
    Alexander Roshal

	Extracting from var-log-cups.rar
	Extracting  error_log OK
	Extracting  access_log.1.gz OK
	Extracting  error_log.2.gz OK
	Extracting  error_log.1.gz OK
	Extracting  access_log OK
	Extracting  access_log.2.gz OK
	All OK

How to list the content of a rar file without uncompressing it?

syntax: unrar l {.rar file-name}	


# unrar l var-log-cups.rar 
	
UNRAR 3.90 beta 2 freeware Copyright (c) 1993-2009
Alexander Roshal
	
Archive var-log-cups.rar
	
Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
access_log.1.gz  106      133 125% 14-11-09 20:37 -rw-r----- A329619E m3b 2.9
access_log.2.gz  190      243 127% 30-10-09 09:44 -rw-r----- CAE8E2DB m3b 2.9

.....