RAR命令

虽说RAR是商业软件, 但是并不妨碍我们使用它啊.

Linux下也有rar命令呢!

建立一个rar压缩包

语法:

  1. rar a {.rar file-name} {file-name}

很简单:

  1. rar a sh.rar *.sh
  2. RAR 5.30 beta 2 Copyright (c) 1993-2015 Alexander Roshal 4 Aug 2015
  3. Trial version Type RAR -? for help
  4. Evaluation copy. Please register.
  5. Creating archive sh.rar
  6. Adding 4.sh OK
  7. Adding cal_random.sh OK
  8. Adding cmd.sh OK
  9. Adding ifs.sh OK
  10. Adding redirect.sh OK
  11. Adding std.sh OK
  12. Done

支持正则, 支持递归.

解压rar压缩包

解压也很简单:

  1. unrar e sh.rar
  2. UNRAR 5.30 beta 2 freeware Copyright (c) 1993-2015 Alexander Roshal
  3. Extracting from sh.rar
  4. Extracting 4.sh OK
  5. Extracting cal_random.sh OK
  6. Extracting cmd.sh OK
  7. Extracting ifs.sh OK
  8. Extracting redirect.sh OK
  9. Extracting std.sh OK
  10. All OK

列出压缩包内的内容

  1. unrar l sh.rar
  2. UNRAR 5.30 beta 2 freeware Copyright (c) 1993-2015 Alexander Roshal
  3. Archive: sh.rar
  4. Details: RAR 4
  5. Attributes Size Date Time Name
  6. ----------- --------- ---------- ----- ----
  7. -rw-rw-r-- 25 2016-01-18 16:10 4.sh
  8. -rw-rw-r-- 542 2015-12-24 14:08 cal_random.sh
  9. -rw-rw-r-- 41 2016-01-18 11:02 cmd.sh
  10. -rw-rw-r-- 27 2016-01-17 19:19 ifs.sh
  11. -rw-rw-r-- 50 2016-01-18 13:24 redirect.sh
  12. -rw-rw-r-- 56 2016-01-18 11:08 std.sh
  13. ----------- --------- ---------- ----- ----
  14. 741 6

压缩加密

  1. rar a -p"Hello" sh.rar *.sh
  2. RAR 5.30 beta 2 Copyright (c) 1993-2015 Alexander Roshal 4 Aug 2015
  3. Trial version Type RAR -? for help
  4. Evaluation copy. Please register.
  5. Creating archive sh.rar
  6. Adding 4.sh OK
  7. Adding cal_random.sh OK
  8. Adding cmd.sh OK
  9. Adding ifs.sh OK
  10. Adding redirect.sh OK
  11. Adding std.sh OK
  12. Done