Linux命令学习笔记(五)---学习命令

[ftt@localhost ~]$ man ls  //man(manual),man page 是“手册页面”,该指令显示ls命令各个方面的信息。

//已知名称,查询功能

[ftt@localhost ~]$ man -f ls
ls (1)               - 列目录内容
ls (1p)              - list directory contents
[ftt@localhost ~]$ whatis ls//该指令比man -f更常用
ls (1)               - 列目录内容
ls (1p)              - list directory contents
//-w(wildcard),进行统配查询man数据库
[ftt@localhost ~]$ whatis -w ls*
ls (1)               - 列目录内容
lsattr (1)           - (未知的主题)
lsearch (3tcl)       - 查看一个列表是否包含一个特定的元素
lsort (3tcl)         - 给一个列表的元素排序

lspci (8)            - 列出所有PCI设备

//-r(regex)可以和正则表达式一起使用

[ftt@localhost ~]$ whatis -r ^rm.*
rm (1)               - 移除文件或者目录
rmdir (1)            - (未知的主题)

//基于功能搜索命令

man -k list

等同于 apropos list,apropos 后可以跟选项 -w或-r

apropos -e list,-e(exact)精准查找


info info //进入“信息页面”,

[ftt@localhost ~]$ whereis shotwell //whereis查询可执行程序,它的源文件(如果存在),手册页面路径
shotwell: /usr/bin/shotwell /usr/lib64/shotwell /usr/libexec/shotwell /usr/share/shotwell /usr/share/man/man1/shotwell.1.gz
[ftt@localhost ~]$ whereis -b shotwell //搜索二进制文件路径
shotwell: /usr/bin/shotwell /usr/lib64/shotwell /usr/libexec/shotwell /usr/share/shotwell
[ftt@localhost ~]$ whereis -m shotwell //搜索手册页面路径
shotwell: /usr/share/man/man1/shotwell.1.gz
[ftt@localhost ~]$ whereis -s shotwell //搜索源文件路径
shotwell:[ftt@localhost ~]$ which shotwell //whereis -b shotwell搜索出两个可执行文件,which可搜索出先运行哪个文件
/usr/bin/shotwell
[ftt@localhost ~]$ which -a shotwell//搜索命令的所与位置同whereis -b
/usr/bin/shotwell
/bin/shotwell

揭示shell如何解释命令

[ftt@localhost ~]$ type ls
ls 是 `ls --color=auto' 的别名
[ftt@localhost ~]$ type cd
cd 是 shell 内嵌

//type -t显示bash如何对待每个命令

共有5种可能:

(1)alias:你所创建的软链接,包括别名的目标文件。这对于硬链接没有效果,不会显示任何内容。

(2)builtin:内置于bash中且自身直接运行的命令,与调用外部程序相对。内建函数的势力有alias/cd/echo/history/source/type。

(3)file:未内置于shell的命令,该命令于外部调用。

(4)function:由Linux,软件或用户创建的函数。与别名类似,type也会输出函数的实际内容。

(5)keyword:仅由bash使用的保留字,如do/for/if/then/while和!。

[ftt@localhost ~]$ type -t ls
alias
[ftt@localhost ~]$ type -t pwd
builtin





猜你喜欢

转载自blog.csdn.net/qq_40951833/article/details/80850135
今日推荐