命令与文件的查询

脚本文件名(命令)的查询:

  外部命令(非bash所提供的命令)的查询:#which name  (which默认情况下是查找PATH内所规范的目录)

  内置在bash中的命令的查询:#type name

 

文件名的查找:

  通常是先使用whereis或者是locate来查找,如果真的找不到了,才以find来查找。因为whereis与locate是利用数据库来查找,相当快速;而find要查询硬盘,速度慢。

  如果要使搜索到的结果更加准确,可以先手动更新数据库,手动更新数据库命令:#updatedb

  #whereis  [-bmsu]  文件名或目录名

  #locate  [-ir]  keyword        (keyword是文件的部分名称)

  #find  [PATH]  [option]  [action]

 

关键字搜索命令:apropos 列出与关键字相关的命令或函数等(apropos命令与man命令的k选项类似,都是从man手册中查找关键字)

  #apropos  关键字      (此处的关键字可以是命令名的一部分或者是某个功能的含义)

  例如:

  #apropos process

  [root@www etc]# apropos process      会列出所有与进程(process)相关的命令函数,很实用
          abort                (3p)  - generate an abnormal process abort
          acct                 (2)  - switch process accounting on or off
          accton               (8)  - turns process accounting on or off
          AF_LOCAL [unix]      (7)  - Sockets for local interprocess communication
          AF_UNIX [unix]       (7)  - Sockets for local interprocess communication
          Apache2::Process     (3pm)  - Perl API for Apache process record

          ......
          _exit                (2)  - terminate the current process
          exit                 (3)  - cause normal process termination
          exit                 (3p)  - terminate a process
          _Exit [_exit]        (2)  - terminate the current process
          _exit [exit]         (3p)  - terminate a process
          _Exit [exit]         (3p)  - terminate a process
          exit_group           (2)  - exit all threads in a process
          fc                   (1p)  - process the command history list
          fork                 (2)  - create a child process
          fork                 (3p)  - create a new process
          ......

posted @ 2013-11-16 10:11  ITtecman  阅读(318)  评论(0编辑  收藏  举报