Linux命令行幫助解析


作為Linux小菜,使用Linux終端命令時總是不知到如何使用相關的參數,如-p ,-r ,使用-和不使用-,一個-和兩個--,有時能夠在網上查詢別人的使用方法,可是使用一次,第二次又忘記了,所以自己還是得掌握查看幫助文檔的方法。

查看幫助:

1、命令 -- help

2、man 命令

后者更加詳細

首先幫助中尖括號<>和方括號[]以及省略號...的含義,

在方括號內的表達式(“[” 和 “]”之間的字符)是可選的(寫命令時要去掉括號)。
在尖括號內的表達式(“[” 和 “]”之間的字符)是必須替換的表達式(而且要去掉括號)。

省略號表示該選項可以單個或多個

以7z的參數為例:

7z <command> [<switches>...] <archive_name> [<file_names>...]  [<@listfiles...>]

7z <命令行> [[選項]...] <檔案名稱(壓縮包名稱)> [<被壓縮的文件名>...] [<@文件列表(如txt文件中的文件列表)...>]

實例分析:

7z a -tzip -p111 archive.zip txt.txt  txt.txt文件壓縮為archive.zip,壓縮方式為zip 密碼為111
7z x -tzip -p111 archive.zip            解壓 密碼為111

a為命令,命令至少要有一個

-t /-p為選項(switch),可選0個或多個,zip和111分別為-t和-p的參數,中間不需要空格    選項(如-r)放前放后都行

7z的命令不區分大小寫,有些命令如cp要區分。。。注意了

命令要點參考
<Commands>
  a: Add files to archive   添加文件到壓縮包中
  b: Benchmark
  d: Delete files from archive   從壓縮包中刪除文件
  e: Extract files from archive (without using directory names)    從壓縮檔案中釋放文件到當前目錄中。或者到指定的輸出文件夾。輸出文件夾設置可以通過 -o (設置輸出文件夾) 選項來更改。
  l: List contents of archive    查看壓縮包中文件列表
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths   在當前目錄中,使用完整路徑從壓縮檔案中釋放文件.或者到指定的輸出文件夾。更多詳細內容請參閱 e (釋放) 命令。
示例
7z x archive.zip
從壓縮檔案 archive.zip 中釋放所有文件到當前文件夾。
7z x archive.zip -oc:\soft *.cpp
從壓縮檔案 archive.zip 中釋放 *.cpp 文件到 c:\soft 文件夾。

<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory   目標文件目錄
  -p{Password}: set Password   {}大括號中為改選項多參數,有些有參數,有些沒有
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries

 選項要點參考
選項        說明
--        阻止選項解析
-ai        附件檔案文件名
-an        不解析檔案名稱
-ao        覆蓋模式
-ax        排除檔案文件名
-i        包括文件名
-m        設置壓縮算法
-o        設置輸出目錄   常用
-p        設置密碼
-r        遞歸子目錄   常用
-sfx        創建自釋放檔案
-si        從StdIn 讀取數據
-so        從StdOut 寫入數據
-t        設置檔案類型
-u        更新選項
-v        創建分卷
-w        設置工作目錄
-x        文件名排除
-y        全是
-- (阻止選項解析) 選項
在命令行中使“--”后的選項開關“-”都失效。這樣就允許在命令行中使用文件名以“-”開頭的文件。

7zip 使用說明 參考:http://apps.hi.baidu.com/share/detail/19870943


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM