man、info、help

文章目录

man和info是独立的命令, --help是个命令的参数, 它们都是Linux中获取帮助信息最权威,最快捷的途径。

1 help

想查看某个命令的用法时,比如查看ls命令的用法,可以执行:

ls  --help

help只能用于查看某个命令的用法。


2 man

man手册既可以查看命令的用法,还可以查看函数的详细介绍等等。它含有9大分类,如下:

section名称说明
1Executable programs or shell commands:可执行程序或shell命令用户可操作的命令
2System calls (functions provided by the kernel) :系统调用内核提供的函数(查头文件)
3Library calls (functions within program libraries):库调用常用的函数库
4Special files (usually found in /dev):特殊文件在/dev下的设备文件
5File formats and conventions eg /etc/passwd :文件格式和约定对一些文件进行解释,如/etc/passpd
6Games:游戏程序游戏程序
7Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7) :杂项包括宏包和约定等
8System administration commands (usually only for root):系统管理员使用的管理命令通常只有系统管理员root可以使用
9Kernel routines [Non standard] :内核相关Linux内核相关文件

比如想查看open函数的用法时,可以直接执行“man open”,发现这不是想要内容时再执行“man 2 open”。

在man命令中可以及时按“h”查看帮助信息了解快捷键。常用的快捷键是:

  • f 往前翻一页
  • b 往后翻一页
  • /patten 往前搜
  • ?patten 往后搜

3 info

就内容来说,info手册比man手册编写得要更全面,但man手册使用起来更容易些。
以书来形容info手册和man手册的话,info手册相当于一章,里面含有若干节,阅读时你需要掌握如果从这一节跳到下一节;而man手册只相当于一节,阅读起来当然更容易。可以直接执行“info”命令后,输入“H”查看它的快捷键,在info手册中,某一节被称为“node”。

常用的快捷键如下:

  • Up Move up one line.

  • Down Move down one line.

  • PgUp Scroll backward one screenful.

  • PgDn Scroll forward one screenful.

  • Home Go to the beginning of this node.

  • End Go to the end of this node.

  • TAB Skip to the next hypertext link.

  • RET Follow the hypertext link under the cursor.

  • l Go back to the last node seen in this window.

  • [ Go to the previous node in the document.

  • ] Go to the next node in the document.

  • p Go to the previous node on this level.

  • n Go to the next node on this level.

  • u Go up one level.

  • t Go to the top node of this document.

  • d Go to the main ‘directory’ node.


参考资料:

  1. 韦东山全系列视频第1季快速入门
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值