当前位置: 首页 > news >正文

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

线上查询及帮助 - man、help

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

man命令的简单介绍

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

man命令的功能说明

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

man命令的语法格式

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

man命令的选项说明

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

man命令的实践操作

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

[root@oldboyedu  ~]# 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命令

[root@oldboyedu  ~]# 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.
[root@oldboyedu  ~]# 

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

[root@oldboyedu  ~]# 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

相关文章:

  • 如何设置Apache虚拟域名
  • 总结下我遇到过的接口测试
  • interface和setter,getter
  • python之路---04 列表 元组
  • 学习进度条
  • MongoDB优化与一些需要注意的细节
  • 星际荣耀获鼎晖投资A+轮投资,上半年将进行首枚入轨运载火箭
  • 让人一看就懂的excel相对引用和绝对引用案例解析
  • [bzoj 3534][Sdoi2014] 重建
  • 第13周Python学习周记
  • SpringBoot 项目中使用velocity模板(转载)
  • 从房地产住宅销售面积增速看房地产行业
  • Android 7.0 中 ContentProvider 实现原理
  • 说说 Vue.js 中的自定义指令
  • mygenerator().next() AttributeError: 'generator' object has no attribute 'next'
  • [ 一起学React系列 -- 8 ] React中的文件上传
  • 【node学习】协程
  • 2017年终总结、随想
  • Create React App 使用
  • oschina
  • python3 使用 asyncio 代替线程
  • react 代码优化(一) ——事件处理
  • React中的“虫洞”——Context
  • Theano - 导数
  • Web标准制定过程
  • 搭建gitbook 和 访问权限认证
  • 道格拉斯-普克 抽稀算法 附javascript实现
  • 如何学习JavaEE,项目又该如何做?
  • 延迟脚本的方式
  • 原创:新手布局福音!微信小程序使用flex的一些基础样式属性(一)
  • media数据库操作,可以进行增删改查,实现回收站,隐私照片功能 SharedPreferences存储地址:
  • Nginx惊现漏洞 百万网站面临“拖库”风险
  • #NOIP 2014# day.1 T2 联合权值
  • #QT(智能家居界面-界面切换)
  • #微信小程序:微信小程序常见的配置传旨
  • (02)Cartographer源码无死角解析-(03) 新数据运行与地图保存、加载地图启动仅定位模式
  • (2015)JS ES6 必知的十个 特性
  • (4)(4.6) Triducer
  • (C++)八皇后问题
  • (附源码)SSM环卫人员管理平台 计算机毕设36412
  • (删)Java线程同步实现一:synchronzied和wait()/notify()
  • (十六)Flask之蓝图
  • (转)C#调用WebService 基础
  • .NET Core 版本不支持的问题
  • .NET Core 中的路径问题
  • .NET/C# 使窗口永不激活(No Activate 永不获得焦点)
  • .netcore 如何获取系统中所有session_如何把百度推广中获取的线索(基木鱼,电话,百度商桥等)同步到企业微信或者企业CRM等企业营销系统中...
  • .sh 的运行
  • :=
  • @Autowired自动装配
  • [AIGC] Nacos:一个简单 yet powerful 的配置中心和服务注册中心
  • [Android]使用Android打包Unity工程
  • [C#]C# OpenVINO部署yolov8图像分类模型
  • [docker] Docker容器服务更新与发现之consul
  • [E单调栈] lc2487. 从链表中移除节点(单调栈+递归+反转链表+多思路)