Rar Command Usage Examples

by Ramesh

How to rar a single file ?

  1. syntax: rar a {.rar file-name} {file-name}
  1. # rar a syslog.rar /var/log/syslog
  2.  
  3. RAR 3.90 beta 2 Copyright (c) 1993-2009
  4. Alexander Roshal 3 Jun 2009
  5. Shareware version Type RAR -? for help
  6. Evaluation copy. Please register.
  7.  
  8. Creating archive syslog.rar
  9. Adding /var/log/syslog OK
  10. Done

How to rar multiple files ?

  1. syntax: rar a {.rar file-name} {file-names}
  2.  
  3. # rar a var-log-cups.rar /var/log/cups/*
  4.  
  5. RAR 3.90 beta 2 Copyright (c) 1993-2009
  6. Alexander Roshal 3 Jun 2009
  7. Shareware version Type RAR -? for help
  8. Evaluation copy. Please register.
  9.  
  10. Creating archive var-log-cups.rar
  11. Adding /var/log/cups/access_log OK
  12. Adding /var/log/cups/access_log.1.gz OK
  13. Adding /var/log/cups/access_log.2.gz OK
  14. Adding /var/log/cups/error_log OK
  15. Adding /var/log/cups/error_log.1.gz OK
  16. Adding /var/log/cups/error_log.2.gz OK
  17. Done

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

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

How to unrar a *.rar compressed file ?

  1. syntax: unrar e {.rar file-name}
  2.  
  3. # unrar e var-log-cups.rar
  4.  
  5. UNRAR 3.90 beta 2 freeware Copyright (c) 1993-2009
  6. Alexander Roshal
  7.  
  8. Extracting from var-log-cups.rar
  9. Extracting error_log OK
  10. Extracting access_log.1.gz OK
  11. Extracting error_log.2.gz OK
  12. Extracting error_log.1.gz OK
  13. Extracting access_log OK
  14. Extracting access_log.2.gz OK
  15. All OK

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

  1. syntax: unrar l {.rar file-name}
  2.  
  3.  
  4. # unrar l var-log-cups.rar
  5.  
  6. UNRAR 3.90 beta 2 freeware Copyright (c) 1993-2009
  7. Alexander Roshal
  8.  
  9. Archive var-log-cups.rar
  10.  
  11. Name Size Packed Ratio Date Time Attr CRC Meth Ver
  12. -------------------------------------------------------------------------------
  13. access_log.1.gz 106 133 125% 14-11-09 20:37 -rw-r----- A329619E m3b 2.9
  14. access_log.2.gz 190 243 127% 30-10-09 09:44 -rw-r----- CAE8E2DB m3b 2.9
  15.  
  16. .....