Shell命令-线上查询及帮助之man、help

线上查询及帮助 - man、help

1、man:获取命令的帮助信息

man命令的简单介绍

man命令是Linux系统中最核心的命令之一 ,因为通过它可以查看其它Linux命令的使用信息。当然了 ,man命令不仅可以查看命令的使用帮助 ,还可以查看软件 服务配置文件、系统调用、库函数等的帮助信息。

man命令的功能说明

man命令用于查看命令的帮助信息。

man命令的语法格式

man [参数选项] 命令/文件

man命令的选项说明

man 选项不常用,此处省略。

man命令的实践操作

范例1:使用man查看cp命令的帮助

[[email protected]  ~]# man cp      <-->一般不加参数,直接跟命令

man命令其实用法很简单,关键就是帮助文档是英文版的,对于一些英文不是很好的学习者来说,简直跟天书似的,在此,我也无能为力,不过可以借助一些翻译工具等。也可以使用搜索引擎进行翻译。

表1:执行man命令后帮助内容中的标题介绍(大部分命令)

man帮助信息中的标题 功能说明(带*为重点)
NAME 命令说明及介绍(常见)*
SYNOPSIS 命令的基本使用语法(常见)*
DESCRIPTION 命令使用详细描述,以及相关参数说明(常用)*
OPTIONS 命令相关参数选项说明
COMMANDS 在执行这个程序(软件)的时候,在此可执行
FILES 程序涉及(或使用或关联)的相关文件
EXAMPLES 命令的一些例子*
SEE ALSO 和命令相关的信息说明
BUGS (REPORTING BUGS) 命令对应缺陷问题的描述
COPYRIGHT 版权信息相关声明
AUTHOR 作者介绍

表2man帮助页面中的快捷键

操作键 功能说明
[Page Down] 向下翻一页(可用空格键替代)
[Page Up] 向上翻一页
[Home] 跳转到第一页
[End] 跳转到最后一页
/word 向下依次查找word字符串(通常跟N或n键使用)
?word 向上依次查找word字符串(通常跟N或n键使用)
q 结束本次man帮助

2、help:获取bash内置命令的帮助信息

help命令的简单介绍

Linux系统里有一些特殊的命令 ,它们就是bash程序的内置命令 ,例如cdhistoryread等 ,这些命令在系统目录里不存在真实的程序文件(存在于bash程序里 ),对于这部分命令,查看帮助的方法就是使用help命令

help命令的实践操作

范例1:使用help查看cd命令

[[email protected]  ~]# help cd
cd: cd [-L|[-P [-e]]] [dir]
    Change the shell working directory.

    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.

    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.

    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.

    Options:
        -L  force symbolic links to be followed
        -P  use the physical directory structure without following symbolic
        links
        -e  if the -P option is supplied, and the current working directory
        cannot be determined successfully, exit with a non-zero status

    The default is to follow symbolic links, as if `-L' were specified.

    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when
    -P is used; non-zero otherwise.
[[email protected]  ~]# 

范例2:使用man查看cd命令

[[email protected]  ~]# man cd
BASH_BUILTINS(1)                                      General Commands Manual                                      BASH_BUILTINS(1)
==========================================================
**提示以下命令在bash里(CentOS7有的bash内置命令也可以使用man查询)**
==========================================================
NAME
       bash,  :,  .,  [, alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, continue, declare, dirs,
       disown, echo, enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout,
       mapfile,  popd,  printf,  pushd,  pwd,  read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, true,
       type, typeset, ulimit, umask, unalias, unset, wait - bash built-in commands, see bash(1)

BASH BUILTIN COMMANDS
       Unless otherwise noted, each builtin command documented in this section as accepting options preceded by  -  accepts  --  to
       signify  the end of the options.  The :, true, false, and test builtins do not accept options and do not treat -- specially.
       The exit, logout, break, continue, let, and shift builtins accept and process arguments beginning with -  without  requiring
       --.  Other builtins that accept arguments but are not specified as accepting options interpret arguments beginning with - as
       invalid options and require -- to prevent this interpretation.
...

原文地址:https://www.cnblogs.com/wjcLinux/p/10650884.html

时间: 2024-08-01 05:27:12

Shell命令-线上查询及帮助之man、help的相关文章

Linux基础命令:(6)线上查询与文件阅读的命令

6.线上查询的命令:(1)man命令:用来查询和解释一个命令的使用方法以及这个命令的说明事项.[man 命令的名称](2)locate命令:定位文件和目录.(3)whatis命令:用来查询某个命令的含义[whatis 命令的名称]:比较适用 7.文件阅读的命令:(1)head命令:用来查看文件的开头部分.[head 文件名,默认是10行](2)tail命令:与head命令相反.有助于查看日志文件结尾的最后10行来阅读重要的系统信息. Linux基础命令:(6)线上查询与文件阅读的命令

150命令之线上查询及帮助命令

150命令之线上查询及帮助命令 man 查询命令的帮助 man + 命令 NAME ???????ls - list directory contents 命令+命令简单说明 ? SYNOPSIS ???????ls [OPTION]... [FILE]... 命令如何使用 名的格式 ? DESCRIPTION 命令的详细说明 ???????List information about the FILEs (the current directory by default). Sort entr

线上查询及帮助命令(2 个)--2

help 是非常简单的命令,而且不经常使用.因为 help 只能获取 Shell 内置命令的帮助,但在 Linux 中绝大多数命令是外部命令,所以 help 命令的作用非常有限.而且内置命令也可以使用 man 命令获取帮助. help 命令的基本信息如下.命令名称:help.英文原意:help.所在路径:Shell 内置命令.执行权限:所有用户.功能描述:显示 Shell 内置命令的帮助. help 命令的格式非常简单:[[email protected] ~]# help 内置命令 Linux

线上查询及帮助命令(2 个)--14.dirname

dirname 命令读取指定路径名删除最后一个“/”(斜杠)及其后面的字符,保留其他部分,并写结果到标准输出.如果最后一个“/”后无字符,dirname 命令使用倒数第二个“/”,并忽略其后的所有字符.dirname 命令在创建路径名的时候遵从以下规则: 如果 Path 参数为“//”(双斜杠),或者参数 Path 全部由斜杠组成,将其转换为单斜杠“/”.跳过步骤 2 到 7. 从指定路径删除尾部的“/”字符. 如果参数 Path 中没有剩下的“/”,则将路径转换成 . (点).跳过步骤 4 到

线上查询及帮助命令

man 作用:命令帮助(详细帮助文档) 使用:man command 例如: [[email protected] ~]# man cp --help 作用:命令帮助(简单帮助文档) 使用:command --help 例如: [[email protected] ~]# cp --help help 作用:命令帮助(适合内置命令) 使用:help command 例如: [[email protected] ~]# help cd

Linux shell 命令行下查询外网IP

查询IP在网页上打开网址就可以显示,但是在命令行下可以安装w3m/Links/Lynx这些命令行浏览器,但是为了这个又感觉不方便,所以很多查IP网站提供了UNIX/LINUX的. 命令行查询(详细): UNIX/Linux: #curl cip.cc Windows:    >telnet cip.cc             >ftp cip.cc              命令行查询(纯ip): UNIX/Linux:    #curl ip.cip.cc 参考: http://www.c

shell 命令 grep -R 查询包含指定内容的文件

grep -R 举个栗子,在有上百个sql文件的目录下,查找使用 spark引擎 执行的文件. 代码是: grep -R spark ./* 返回的就是包含  spark 的sql文件名. 原文地址:https://www.cnblogs.com/drjava/p/10712365.html

线上问题排查命令----Shell篇

创建: 刘新宇,最新修改: 大约4小时以前 转至元数据起始 1.跟踪线上日志定时刷新最新内容 tail -fn 200 $log 2.查找指定字符串 #只显示匹配行 grep $String $file #匹配字符串所在行的上下n行 grep -C n $String $file #匹配字符串的行数有多少  grep $String $file | wc -l #匹配字符串高亮显示 grep --color $String $file #使用正则 grep -E $String $file 3.

Java 开发必须掌握的线上问题排查命令

作为一个合格的开发人员,不仅要能写得一手还代码,还有一项很重要的技能就是排查问题.这里提到的排查问题不仅仅是在coding的过程中debug等,还包括的就是线上问题的排查.由于在生产环境中,一般没办法debug(其实有些问题,debug也白扯...),所以我们需要借助一些常用命令来查看运行时的具体情况,这些运行时信息包括但不限于运行日志.异常堆栈.堆使用情况.GC情况.JVM参数情况.线程情况等. 给一个系统定位问题的时候,知识.经验是关键,数据是依据,工具是运用知识处理数据的手段.为了便于我们