New Immissions/Updates:
boundless - educate - edutalab - empatico - es-ebooks - es16 - fr16 - fsfiles - hesperian - solidaria - wikipediaforschools
- wikipediaforschoolses - wikipediaforschoolsfr - wikipediaforschoolspt - worldmap -

See also: Liber Liber - Libro Parlato - Liber Musica  - Manuzio -  Liber Liber ISO Files - Alphabetical Order - Multivolume ZIP Complete Archive - PDF Files - OGG Music Files -

PROJECT GUTENBERG HTML: Volume I - Volume II - Volume III - Volume IV - Volume V - Volume VI - Volume VII - Volume VIII - Volume IX

Ascolta ""Volevo solo fare un audiolibro"" su Spreaker.
CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Wikipedia:格式手册 (命令行范例) - Wikipedia

Wikipedia:格式手册 (命令行范例)

维基百科,自由的百科全书

维基百科格式指导
格式手册
增补格式手册

縮寫
传记
命令行范例
破折号
日期和数字
标题
链接
数学
音樂
音标
文字格式
题目
商标
撰寫有關小說條目

特殊頁面指導

消歧义页
中国相关条目
日本相关条目
朝鮮相關條目
醫學相關條目

其他指导

如何编辑页面
版面指南
题注
分类
人物分类
引用來源
行话解释
註腳
更优秀条目写作指南
列表
音樂樣本
命名约定
過度連結
图片指南
固有名称
章节
姊妹计划
术语和定义
避免使用的用詞

技術指導

图像
圖像使用守則
列表格式指南
表格
用戶樣式

Command-line examples are used to specify the syntax of shell commands or programs as a user would type them into a terminal or command prompt. This page is intended to function as a style guide for writers and editors of articles related to Computer science on Wikipedia.

目录

[编辑] General guidelines

When providing command-line examples, it is necessary to maintain clarity and simplicity. Not only does this result in a more professional look, but it prevents the reader from becoming confused. The following guidelines are given to help establish what defines clear and simple examples.

  • Command-line examples should be presented in a monospaced font. The initial presentation should use the Wikipedia method that involves prefixing commands with a space. Further references should be contained in <tt> (teletype) tags.
  • Wikipedia is not a medium for the presentation of writers' personal preferences. As such, there should not be any reference to environment, date, working directory, user name, or host name unless absolutely necessary.
  • Terminology: An option is a switch (something that modifies the general behavior of the command). A parameter is a specific value, such as a file or host name. The term argument is used to refer to any of the space-separated strings that follow a command name, including both options and parameters.
  • When presenting arguments, care should be taken to maintain simplicity. Specifying them without explanation can confuse the reader.
  • Wikipedia is not a substitute for manual pages. Articles should not document the entire list of options associated with a command unless there are very few such options or such descriptiveness is absolutely necessary.
  • When specifying parameters, logical names should be used to refer to them. These names should be italicised and should not contain spaces, as spaces are used to separate multiple arguments on the command line. The following are some examples:
(prompt) command parameter-name
(prompt) command parameterName
(prompt) command parameter_name
(prompt) command parametername
  • Consistency is important. Do not confuse the reader by using all four methods of naming parameters in the same article.
  • Arguments that are not required and may be completely omitted should be enclosed within square brackets, [ and ].
  • There are many ways of specifying repeating parameters; the following two are the most common:
(prompt) command parameter0 [.. parameterN]
(prompt) command [parameter ...]

[编辑] Platform-specific guidelines

[编辑] DOS

The most common disk operating system in use today is MS-DOS. As such, examples that might be specific to MS-DOS do not need to indicate this. However, if the examples are specific to a certain version of MS-DOS, then they should be indicated as such. If equivalents in other DOSes differ and are known, they should be provided.

The following additional guidelines should be followed for DOS command-line examples:

  • The names of commands and programs should be provided in all upper-case letters.
  • Standard MS-DOS-style options (of the form /C where C is some character) should also be upper-case, unless they are case sensitive.
  • Program names should be contrasted against built-in command names by appending their appropriate file extension. If a specific program is not included with certain versions of MS-DOS (such as MOVE.EXE or EDIT.COM), then the versions for which it is known to be included should be indicated.

[编辑] Unix-like systems

  • Most commands on Unix-like systems are actually references to executable files. Commands that are native to a shell (such as cd or history) should be indicated as such.
  • The most common shell on Unix-like systems has varied greatly. As a result, shell-specific commands or utilities (such as the for loop or certain stream behaviors) should be avoided whenever possible.
  • If a shell-specific sequence is required for proper explanation, then an example should be provided for both the ALGOL-like sequence of sh, ksh, and bash as well as one for the C-like syntax of csh and tcsh. This is not necessary if there is no difference in the syntax.
  • The names of most commands on Unix-like systems are made up of all lower-case characters. However, due to the case-sensitive nature of the shell and operating environment, care should be taken to ensure that the capitalisation given matches that of the command or file name. Use of the wrong title template is recommended as well when necessary.
  • Commands that normally require privileged access should be differentiated from those that do not require it. If a command does require priveleged access, then a disclaimer should be included indicating the risk of running commands with unrestricted priveleged access.
  • In some cases, it is very likely the value of a parameter will contain some shell Meta-characters. In these cases, it may be wise to specify quoting in the example to prevent users from receiving errors that to them will seem strange and unrelated.

[编辑] Providing sample output

It may often be prudent to provide a sample of the output that a command is expected to generate. In these cases, the full command and all arguments as they were typed are given. The output of the command will therefore be specific to environment and other variables.

[编辑] Examples of usage

[编辑] DOS

  • The DIR built-in command on DOS, which lists files and directories:
> DIR [options] [pattern ..]
  • The program MOVE.EXE on MS-DOS (whose behavior had to be emulated prior to its introduction):
> MOVE.EXE source target

[编辑] 常规Unix

  • 用Unix风格系统上的ls命令列出文件和目录:
$ ls [options] [file ..]
  • 用mkfs命令创建新的文件系统,通常需要一定的权限:
# mkfs [-t fstype] [fs-options] device
  • wget程序,GNU实用工具之一,根据给出的URI获取文件。URI可以包含shell的元字符,因此参数需要加引号以防止出错。
$ wget [options] "URI"

[编辑] Shell特性

  • sh/ksh/bash中内置if结构的语法异同:
$ if command ; then command ; .. ; fi

在csh/tcsh中:

% if (expression) then command ; .. ; endif

[编辑] 输出举例

  • df命令的输出举例,列出了挂载的文件系统磁盘空间使用情况:
$ df -P
Filesystem          512-blocks      Used Available Capacity Mounted on
/dev/hda2             39331760   7398904  29834768      20% /
其他语言

Static Wikipedia (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2007 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2006 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu

Static Wikipedia February 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu