从Shell中寻找帮助:修订间差异

来自tutorials.sdfcn.org - sdf中文html教程
跳转到导航 跳转到搜索
创建页面,内容为“提示:你可以进一步查看 SDF 的具体帮助说明,如 FAQ! 虽然 UNIX shell 看起来有点令人生畏和冰冷,它有两个字母的神秘命令、几十个命令行开关,而且没有动画回形针为你指明方向,但有几种不同的方法可以从系统中获得帮助。 ---- === 使用手册(帮助文档) === 获取帮助的最简单、最全面的方法就是阅读手册。在使用电脑的过程中,你可能在某个地…”
 
无编辑摘要
第9行: 第9行:
在哪里可以找到它们?其实很简单。想想一个命令(ls、rm、chmod、kill、grep)或一个程序(vi、mutt、snarf、majordomo),然后继续键入<syntaxhighlight lang="shell" line="1">
在哪里可以找到它们?其实很简单。想想一个命令(ls、rm、chmod、kill、grep)或一个程序(vi、mutt、snarf、majordomo),然后继续键入<syntaxhighlight lang="shell" line="1">
% man command
% man command
</syntaxhighlight>其中<code>command</code>正是你想了解的命令的名称。正如你所看到的,手册被分成不同的部分。我们以 <code>mkdir</code> 为例。<syntaxhighlight lang="shell-session">
</syntaxhighlight>其中<code>command</code>正是你想了解的命令的名称。正如你所看到的,手册被分成不同的部分。我们以 <code>mkdir</code> 为例。<syntaxhighlight lang="shell-session" line="1">
% man mkdir
% man mkdir
MKDIR(1)                NetBSD General Commands Manual                 
MKDIR(1)                NetBSD General Commands Manual                 
第15行: 第15行:


NAME
NAME
     mkdir - make directories                                                   mkdir - 创建目录
     mkdir - make directories


SYNOPSIS
SYNOPSIS
第21行: 第21行:


DESCRIPTION
DESCRIPTION
     mkdir creates the directories named as operands, in the order specified,   使用mkdir按照指定对象的顺序创建目录,
     mkdir creates the directories named as operands, in the order specified,
     using mode rwxrwxrwx (0777) as modified by the current umask(2).           默认使用当前由umask规定的模式 rwxrwxrwx (0777)
     using mode rwxrwxrwx (0777) as modified by the current umask(2).


     The options are as follows:                                               可选项如下:
     The options are as follows:


     -m      Set the file permission bits of the final created directory to     -m  将最终创建目录的文件权限设置为指定模式。
     -m      Set the file permission bits of the final created directory to
             the specified mode.  The mode argument can be in any of the for-       模式参数可以是为 chmod(1) 工具指定的任何模式。
             the specified mode.  The mode argument can be in any of the for-
             mats specified to the chmod(1) utility.  If a symbolic mode is         如果指定的是符号模式,操作符 ``+'' 和 ``-'' 将
             mats specified to the chmod(1) utility.  If a symbolic mode is
             specified, the operation characters ``+'' and ``-'' are inter-         相对于初始模式 ``a=rwx'' 进行解释。
             specified, the operation characters ``+'' and ``-'' are inter-
             preted relative to an initial mode of ``a=rwx''.
             preted relative to an initial mode of ``a=rwx''.


     -p      Create intermediate directories as required.  If this option is   -p  根据需要创建中间目录。 如果未指定该选项,
     -p      Create intermediate directories as required.  If this option is
             not specified, the full path prefix of each operand must already       则每个操作数的完整路径前缀必须已经存在。
             not specified, the full path prefix of each operand must already
             exist.  Intermediate directories are created with permission bits     创建的中间目录权限为 rwxrwxrwx (0777),
             exist.  Intermediate directories are created with permission bits
             of rwxrwxrwx (0777) as modified by the current umask, plus write       由当前 umask 修改,外加所有者的写入和搜索权限。
             of rwxrwxrwx (0777) as modified by the current umask, plus write
             and search permission for the owner.  Do not consider it an error     如果参数目录已经存在,则不视为错误。
             and search permission for the owner.  Do not consider it an error
             if the argument directory already exists.                                 译者注:比如命令 mkdir -p intermediate/name,
             if the argument directory already exists.
                                                                                                其中intermediate就为中间目录,若中间目录不存在则创建一个。
 
                                                                                                若不加参数 -p 则会报错。
 
     The user must have write permission in the parent directory.               用户必须有写入父目录的权限。
     The user must have write permission in the parent directory.
                                                                                
                                                                                
EXIT STATUS                                                                     退出状态
EXIT STATUS
     mkdir exits 0 if successful, and >0 if an error occurred.                 mkdir 如果成功则退出 0,如果出错则退出 >0。
     mkdir exits 0 if successful, and >0 if an error occurred.


SEE ALSO                                                                       也请看
SEE ALSO
     chmod(1), rmdir(1), mkdir(2), umask(2)                                    chmod(1), rmdir(1), mkdir(2), umask(2)
     chmod(1), rmdir(1), mkdir(2), umask(2)


STANDARDS                                                                       标准
STANDARDS
     The mkdir utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compat- mkdir 工具有望与 IEEE Std 1003.2("POSIX.2")兼容。
     The mkdir utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compat-
     ible.
     ible.
NetBSD 2.0.2                  January 25, 1994                  NetBSD
2.0.2
</syntaxhighlight>以下为说明的翻译<ref>使用man命令之后,说明命令的括号为</ref>:<syntaxhighlight lang="shell-session" line="1">
% man mkdir
MKDIR(1)                NetBSD General Commands Manual               
MKDIR(1)
名称
    mkdir - 创建目录
摘要
    mkdir [-p] [-m mode] directory_name ...
描述
    使用mkdir按照指定对象的顺序创建目录,
    默认使用当前由umask规定的模式 rwxrwxrwx (0777)
    可选项如下:
    -m      将最终创建目录的文件权限设置为指定模式。
            模式参数可以是为 chmod(1) 工具指定的任何模式。
            如果指定的是符号模式,操作符 ``+'' 和 ``-'' 将
            相对于初始模式 ``a=rwx'' 进行解释。
           
    -p      根据需要创建中间目录。 如果未指定该选项,
            则每个操作数的完整路径前缀必须已经存在。
            创建的中间目录权限为 rwxrwxrwx (0777),
            由当前 umask 修改,外加所有者的写入和搜索权限。
            如果参数目录已经存在,则不视为错误。
                译者注:比如命令 mkdir -p intermediate/name,
                其中intermediate就为中间目录,若中间目录不存在则创建一个。
                若不加参数 -p 则会报错。
    用户必须有写入父目录的权限。
                                                                             
退出状态
    mkdir 如果成功则退出 0,如果出错则退出 >0。
也请看
    chmod(1), rmdir(1), mkdir(2), umask(2)
标准
    mkdir 工具有望与 IEEE Std 1003.2("POSIX.2")兼容。


NetBSD 2.0.2                  January 25, 1994                  NetBSD  
NetBSD 2.0.2                  January 25, 1994                  NetBSD  
2.0.2
2.0.2
</syntaxhighlight>
</syntaxhighlight>

2023年8月4日 (五) 03:35的版本

提示:你可以进一步查看 SDF 的具体帮助说明,如 FAQ!

虽然 UNIX shell 看起来有点令人生畏和冰冷,它有两个字母的神秘命令、几十个命令行开关,而且没有动画回形针为你指明方向,但有几种不同的方法可以从系统中获得帮助。


使用手册(帮助文档)

获取帮助的最简单、最全面的方法就是阅读手册。在使用电脑的过程中,你可能在某个地方听说过 RTFM(Read The Fscking Manual),这就是那本《手册》。手册是每种 UNIX 的标准文档形式。学会使用它们。学会爱护它们。

在哪里可以找到它们?其实很简单。想想一个命令(ls、rm、chmod、kill、grep)或一个程序(vi、mutt、snarf、majordomo),然后继续键入

% man command

其中command正是你想了解的命令的名称。正如你所看到的,手册被分成不同的部分。我们以 mkdir 为例。

% man mkdir
MKDIR(1)                NetBSD General Commands Manual                
MKDIR(1)

NAME
     mkdir - make directories

SYNOPSIS
     mkdir [-p] [-m mode] directory_name ...

DESCRIPTION
     mkdir creates the directories named as operands, in the order specified,
     using mode rwxrwxrwx (0777) as modified by the current umask(2).

     The options are as follows:

     -m      Set the file permission bits of the final created directory to
             the specified mode.  The mode argument can be in any of the for-
             mats specified to the chmod(1) utility.  If a symbolic mode is
             specified, the operation characters ``+'' and ``-'' are inter-
             preted relative to an initial mode of ``a=rwx''.

     -p      Create intermediate directories as required.  If this option is
             not specified, the full path prefix of each operand must already
             exist.  Intermediate directories are created with permission bits
             of rwxrwxrwx (0777) as modified by the current umask, plus write
             and search permission for the owner.  Do not consider it an error
             if the argument directory already exists.


     The user must have write permission in the parent directory.
                                                                               
EXIT STATUS
     mkdir exits 0 if successful, and >0 if an error occurred.

SEE ALSO
     chmod(1), rmdir(1), mkdir(2), umask(2)

STANDARDS
     The mkdir utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compat-
     ible.

NetBSD 2.0.2                   January 25, 1994                   NetBSD 
2.0.2

以下为说明的翻译[1]

% man mkdir
MKDIR(1)                NetBSD General Commands Manual                
MKDIR(1)

名称
     mkdir - 创建目录

摘要
     mkdir [-p] [-m mode] directory_name ...

描述
     使用mkdir按照指定对象的顺序创建目录,
     默认使用当前由umask规定的模式 rwxrwxrwx (0777)

     可选项如下:

     -m      将最终创建目录的文件权限设置为指定模式。 
             模式参数可以是为 chmod(1) 工具指定的任何模式。 
             如果指定的是符号模式,操作符 ``+'' 和 ``-'' 将
             相对于初始模式 ``a=rwx'' 进行解释。
             

     -p      根据需要创建中间目录。 如果未指定该选项,
             则每个操作数的完整路径前缀必须已经存在。 
             创建的中间目录权限为 rwxrwxrwx (0777),
             由当前 umask 修改,外加所有者的写入和搜索权限。
             如果参数目录已经存在,则不视为错误。
                 译者注:比如命令 mkdir -p intermediate/name,
                 其中intermediate就为中间目录,若中间目录不存在则创建一个。
                 若不加参数 -p 则会报错。
     用户必须有写入父目录的权限。
                                                                               
退出状态
     mkdir 如果成功则退出 0,如果出错则退出 >0。

也请看
     chmod(1), rmdir(1), mkdir(2), umask(2)

标准
     mkdir 工具有望与 IEEE Std 1003.2("POSIX.2")兼容。


NetBSD 2.0.2                   January 25, 1994                   NetBSD 
2.0.2
  1. 使用man命令之后,说明命令的括号为