原创Blog,转载请注明出处

http://blog.csdn.net/hello_hwc

我的虚拟机系统是CentOS。版本号较老,谅解

一、为什么要学习帮助命令?

  授人以鱼不如授人以渔。学会了怎么看帮助文档。是寻找到一个解决一类问题。而不是一个问题的方法。





二、经常使用的几个命名

1、man


-w 打印相关帮助文档的位置

-k 在man页中查找指定字符串和apropos命令同样

-f 和whatis同样



然后我们通过man ls命令来具体分析下man page中的内容

[root@localhost ~]# man ls
LS(1) User Commands LS(1) NAME
ls - list directory contents SYNOPSIS
ls [OPTION]... [FILE]... DESCRIPTION
List information about the FILEs (the current directory by
default). Sort entries alphabetically if none of -cftuvSUX
nor --sort. Mandatory arguments to long options are mandatory for short
options too. -a, --all
do not ignore entries starting with . -A, --almost-all
do not list implied . and ..
...中间省略
AUTHOR
Written by Richard Stallman and David MacKenzie. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright © 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it
under the terms of the GNU General Public License
<http://www.gnu.org/licenses/gpl.html>. There is NO WAR-
RANTY, to the extent permitted by law. SEE ALSO
The full documentation for ls is maintained as a Texinfo man-
ual. If the info and ls programs are properly installed at
your site, the command info ls should give you access to the complete manual. ls 5.97 February 2010 LS(1)

这里能够看到。info ls能够给出具体描写叙述

首先会看到NAME。COPYRIGHT等每一部分的title,详细代表含义參照下面

NAME		名字,简单的命令是用来做什么的
SYNOPSIS 简短的指令使用语法
DESCRIPTION 具体的描写叙述命令的用法
OPTIONS 针对SYNOPSIS。进行具体的阐述
COMMANDS 运行的时候可下达的命令
FILES 指令相关的文件
SEE ALSO 和这个指令相关的命令
EXAMPLE 范例
BUGS 尚存在的漏洞
COPYRIGHT 版权信息
REPORTING BUGS 发现Bug能够上传的邮箱
AUTHOR 作者

然后,又会看到LS(1)后面跟了一个1,这个数字也是有特定含义的

1	指令或者可运行文档
2 内核可调用的函数
3 经常使用函数库
4 档案说明
5 档案格式
6 游戏
7 linux系统的说明性内容
8 root可用的管理命名
9 和内核相关的文件

在man页中怎样翻页,查找

箭头上下 上下行切换

Home/End 到第一页、最后一页

/String 查找一个字符串,n下一个查找到的结果,N上一个

q 结束这次

何时用man命令

我的心得是:这个命令基本不熟悉,须要具体的去看看自己想要的功能怎样使用的时候,一般顺序是NAME-SYNOPSIS-DESCRIPTION-EXAMPLE





2、--help

列出经常使用命名的经常使用选项

使用场合:知道这个命令的使用领域,和简单用法,仅仅是不熟悉某些选项

[root@localhost ~]# file --help
Usage: file [OPTION]... [FILE]...
Determine file type of FILEs. -m, --magic-file LIST use LIST as a colon-separated list of magic
number files
-z, --uncompress try to look inside compressed files
-b, --brief do not prepend filenames to output lines
-c, --checking-printout print the parsed form of the magic file, use in
conjunction with -m to debug a new magic file
before installing it
-f, --files-from FILE read the filenames to be examined from FILE
-F, --separator string use string as separator instead of `:'
-i, --mime output mime type strings
-k, --keep-going don't stop at the first match
-L, --dereference causes symlinks to be followed
-n, --no-buffer do not buffer output
-N, --no-pad do not pad output
-p, --preserve-date preserve access times on files
-r, --raw don't translate unprintable chars to \ooo
-s, --special-files treat special (block/char devices) files as
ordinary ones
--help display this help and exit
--version output version information and exit

3、whatis

查找whatis的数据库。寻找keyword的描写叙述信息。

在我们学会了man之后,能够直接man whatis来看信息

使用场合:我们想知道这个命令使用来干嘛的,或者我们想知道这个命令的种类

[root@localhost ~]# whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
[root@localhost ~]# whatis CD
cd (1p) - change the working directory
cd [builtins] (1) - bash built-in commands, see bash(1)

4、help

查看shell内建指令的帮助信息,比如我们cd就是一个bash内建指令

[root@localhost ~]# cd --help
bash: cd: --: invalid option
cd: usage: cd [-L|-P] [dir]
[root@localhost ~]# help cd
cd: cd [-L|-P] [dir]
Change the current directory to DIR. The variable $HOME is the
default DIR. 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, i.e. `.'. 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, then try the word as a variable
name. If that variable has a value, then cd to the value of that
variable. The -P option says to use the physical directory structure
instead of following symbolic links; the -L option forces symbolic links
to be followed.

其它的内建指令

alias, bg, bind, break, builtin, cd, command,
compgen, complete, continue, declare, dirs, disown, echo,
enable, eval, exec, exit, export, fc, fg, getopts, hash, help,
history, jobs, kill, let, local, logout, popd, printf, pushd,
pwd, read, readonly, return, set, shift, shopt, source, sus-
pend, test, times, trap, type, typeset, ulimit, umask, una-
lias, unset, wait

linux经常使用命令-帮助命令-授之以渔的更多相关文章

  1. linux shell 中的sleep命令

    开始还以为是这样的语法: sleep(1), 后面发现是: linux shell 中的sleep命令 分类: LINUX 在有的shell(比如linux中的bash)中sleep还支持睡眠(分,小 ...

  2. linux配置网卡IP地址命令详细介绍及一些常用网络配置命令

    linux配置网卡IP地址命令详细介绍及一些常用网络配置命令2010-- 个评论 收藏 我要投稿 Linux命令行下配置IP地址不像图形界面下那么方 便,完全需要我们手动配置,下面就给大家介绍几种配置 ...

  3. linux中5条查找命令

    1 which which命令的作用是,在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果. which [文件...] 参 数: -n<文件名长度> 指定文件名长 ...

  4. linux管道命令grep命令参数及用法详解---附使用案例|grep

    功能说明:查找文件里符合条件的字符串. 语 法:grep [-abcEFGhHilLnqrsvVwxy][-A<显示列数>][-B<显示列数>][-C<显示列数>] ...

  5. Linux常用命令学习2---(文件搜索命令locate find、命令搜索命令whereis which、字符串搜索命令grep、帮助命令man)

     1.文件搜索命令:locate [文件名]    在后台数据库中按文件名搜索,搜索速度比find快,耗费资源更少    例子:locate test.txt,就会显示文件名包含 test.txt的所 ...

  6. linux命令:crontab命令(转)

    一.crond简介 二.crond服务 三.crontab命令详解 四.使用注意事项 linux系统是由 cron (crond) 这个系统服务来控制的.Linux 系统上面原本就有非常多的计划性工作 ...

  7. 【日常小记】linux中强大且常用命令:find、grep【转】

    转自:http://www.cnblogs.com/skynet/archive/2010/12/25/1916873.html 在linux下面工作,有些命令能够大大提高效率.本文就向大家介绍fin ...

  8. LINUX的磁盘管理du命令详解

    LINUX的磁盘管理du命令详解 du(disk usage)命令可以计算文件或目录所占的磁盘空间.没有指定任何选项时, 它会测量当前工作目录与其所有子目录,分别显示各个目录所占的快数,最后才显示工作 ...

  9. Linux 常用命令 :cd命令

    ls命令是linux下最常用的命令.ls命令就是list的缩写缺省下ls用来打印出当前目录的清单如果ls指定其他目录那么就会显示指定目录里的文件及文件夹清单. 通过ls 命令不仅可以查看linu ...

  10. Linux 常用命令 :ls命令

    ls命令是linux下最常用的命令.ls命令就是list的缩写缺省下ls用来打印出当前目录的清单如果ls指定其他目录那么就会显示指定目录里的文件及文件夹清单. 通过ls 命令不仅可以查看linu ...

随机推荐

  1. 【Linux】使用cat命令创建文本文件

    在Linux界面输入 Linux:/usr/test # cat >test01.sh 接着按回车,输入内容:"echo hello world !" 回车后按 ctrl+d ...

  2. 常见pip方法

    pip search 包名   查询 pip install  包名   安装包 pip show--files 包名 pip list --outdated  检查哪些包需要更新 pip insta ...

  3. RHEL7-openldap安装配置三(客户端自动挂载配置)

    前两篇文章我们配置好了LDAP服务端和LDAP客户端.这篇文章将讲述从LDAP客户机服务器上挂载NFS服务器上共享的目录. 1.LDAP服务器上NFS共享配置 1.1 NFS服务也可以单独搭建在另外一 ...

  4. QQ通讯录VS360通讯录对新建信息界面中草稿的处理

    在新建信息界面中,对草稿信息的处理. 1. QQ通讯录的处理是: 如果信息编辑框不为空,点击HOME键或者点击BACK键,保存草稿,同时结束新建信息界面. 如果收件人为空,也保存草稿,只是将收件人取名 ...

  5. 【TP3.2+Oracle】数据进行分页

    1.写在前面:mysql的分页 通过limit 关键字进行处理, oracle却没有limit,而是用ROWNUM 字段来进行分页 2.参考示例,TP3.2 代码,其实原理看懂了 其他框架和原生都可以 ...

  6. Maven实战——Gradle,构建工具的未来?

    许晓斌-- 四月 05, 2011 Maven面临的挑战 软件行业新旧交替的速度之快往往令人咂舌,不用多少时间,你就会发现曾经大红大紫的技术已经成为了昨日黄花,当然,Maven也不会例外.虽然目前它基 ...

  7. Swift3 CADisplayLink简单用法

    1.定义属性 var displayLinkTimer:CADisplayLink? = nil 2.init displayLinkTimer = CADisplayLink(target: sel ...

  8. linux RPM包安装、更新、删除等操作命令简明总结, 如何查看yum安装的软件路径 ?

    rpm -ivh package.rpm 安装一个rpm包rpm -ivh --nodeeps package.rpm 安装一个rpm包而忽略依赖关系警告rpm -U package.rpm 更新一个 ...

  9. 工欲善其事,必先利其器 软件工具开发关键词 protractor自动化测试工具 RegexBuddy正则 CodeSmith,LightSwitch:代码生成 CheatEngine:玩游戏修改内存值必备神器 ApkIDE:Android反编译工具 Reflector:反编译dll动态链接库

    工欲善其事,必先利其器 本文版权归翟士丹(Stan Zhai)和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利. 原文地址:http ...

  10. CSS中详解height属性

    目录结构: contents structure [+] hight属性值类型一览表 height的%的使用 定义 实例 需要注意的 参考文章 hight属性值类型一览表 value describt ...