《The Linux Command Line》 读书笔记02 关于命令的命令
2014-01-09 20:39
405 查看
《The Linux Command Line》 读书笔记02 关于命令的命令
命令的四种类型
type
type—Indicate how a command name is interpreted.type命令:展示命令的类型。
which
which—Display which executable program will be executed.which命令:展示可执行命令的位置。
因为可执行命令有可能会有多个版本,所以有必要根据位置来判断究竟是哪个。
which仅对可执行程序有效,对shell内置命令和alias无效。
help
help命令:得到shell内置命令的帮助,使用时是help后跟shell内置命令:help command
比如:
help cd
--help
命令选项(option):--help展示使用信息。很多可执行程序都支持一个--help的option来展示命令的信息。
有一些程序并不支持—help选项,但是可以试试。
man
man—Display a command’s manual page.大多数可执行程序都提供一个正式的文档,叫做manual或者man page,man命令就是用来查看这个文档。
man是用less来展示文档的。
apropos
apropos—Display a list of appropriate commands.apropos命令,根据关键字查询可能合适的命令。
man命令加-k和apropos是一样的效果,可以man man看一下。
whatis
whatis—Display a very brief description of a command.whatis命令,展示一个命令的非常简短的描述。
info
info—Display a command’s info entry.GNU项目提供了man pages的替代品:info pages。
info pages由一个叫做info的阅读程序展示。
alias
alias—Create an alias for a command.多个命令可以由分号间隔放在同一行执行:
command1; command2; command3…
可以使用alias为多个命令的序列起一个别名。
使用alias的第一件事,就是起一个新的名字,首先要检查一下这个名字是否被使用过(可以用type命令检查)。
想到了一个没有被使用过的名字之后,就可以利用alias命令了:
命令格式如下:
alias newname=’string’
在alias关键字之后,是一个自定义的名字,之后是一个等号,然后是一个单引号包含的字符串,是要赋予这个自定义名字的意义。
定义好之后,这个新的名字就可以像命令一样在shell中使用了。
可以用type命令来检查它,也可以用unalias来取消它。
当alias后面不跟任何参数独自出现的时候,可以查看当前所有存在的别名。
注意,当shell session结束时别名会消失。
相关文章推荐
- 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令
- 《The Linux Command Line》 读书笔记01 基本命令介绍
- The Linux Command Line 读书笔记(二)之文件系统The file system操作的命令
- 《The Linux Command Line》 读书笔记03 ls命令与长格式输出解释 文件权限
- 《The Linux Command Line》中的命令
- The Linux Command Line 读书笔记(一)初识shell
- The Linux Command Line 读书笔记(三)操作文件和目录
- The Linux Command Line---读书笔记
- 关于linux里pg command 命令的简单理解——学习笔记
- Locating files using the find command(linux find命令)
- Install the AWS Command Line Interface on Linux
- The Linux Command Line 1-10章总结
- the linux command line学习笔记之五
- The Linux Command Line 学习笔记(1-10章)
- The Linux Command Line 21-30章总结
- Beginning the Linux Command Line--第2章 完成基本命令行任务
- The Linux Command Line 11-20章总结
- the linux Command Line 学习笔记--mysql命令行导入sql文件到指定数据库的方法
- 资源分享 | The Linux Command Line 的中文版
- 通过《 The Linux Command Line》入门linux命令行