whatis 用于查询一个命令执行什么功能,并将查询结果打印到终端上

which 查看可执行文件的位置

whereis 查看文件的位置

man Linux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找,只要man一下即可

locate 配 合数据库查看文件位置

find 实际搜寻硬盘查询文件名称

type 用来区分某个命令是否是shell自带的

  1. whatis

    whatis 用于查询一个命令执行什么功能,并将查询结果打印到终端上
whatis whatis
whatis (1) - display one-line manual page descr... whatis which
which (1) - locate a command whatis whereis
whereis (1) - locate the binary, source, and man... whatis man
man (1) - an interface to the on-line refere...
man (7) - macros to format man pages whatis locate
locate (1) - find files by name whatis find
find (1) - search for files in a directory hi... whatis type
type: nothing appropriate. whatis who
who (1) - show who is logged on whatis top
top (1) - display Linux processes
  1. which

    which命令是查找这个命令是否存在系统中,以及命令存放的位置在哪儿.
which whatis
/usr/bin/whatis which which
/usr/bin/which which whereis
/usr/bin/whereis which man
/usr/bin/man which locate
/usr/bin/locate which find
/usr/bin/find
which type which ls
/bin/ls which cat
/bin/cat which top
/usr/bin/top which python
/usr/bin/python which python3
/usr/bin/python3 which pip
/usr/bin/pip which mysql
/usr/bin/mysql which mysqld
/usr/sbin/mysqld which vim
/usr/bin/vim which sqlite
  1. whereis

    whereis命令只能用于搜索程序名,而且只搜索二进制文件(参数-b)、man说明文件(参数-m)和源代码文件(参数-s)。如果省略参数,则返回所有信息。
whereis whatis
whatis: /usr/bin/whatis /usr/share/man/man1/whatis.1.gz whereis which
which: /usr/bin/which /bin/which /usr/share/man/man1/which.1.gz whereis whereis
whereis: /usr/bin/whereis /usr/share/man/man1/whereis.1.gz whereis man
man: /usr/bin/man /usr/local/man /usr/share/man /usr/share/man/man1/man.1.gz /usr/share/man/man7/man.7.gz whereis locate
locate: /usr/bin/locate /usr/share/man/man1/locate.1.gz whereis find
find: /usr/bin/find /usr/share/man/man1/find.1.gz /usr/share/info/find.info.gz whereis type
type: whereis vim
vim: /usr/bin/vim.basic /usr/bin/vim /usr/bin/vim.tiny /etc/vim /usr/share/vim /usr/share/man/man1/vim.1.gz whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /etc/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz whereis mysqld -b
mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz whereis mysqld
mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz whereis python
python: /usr/bin/python /usr/bin/python3.5m /usr/bin/python3.5 /usr/bin/python2.7 /usr/bin/python2.7-config /usr/lib/python3.5 /usr/lib/python2.7 /etc/python /etc/python3.5 /etc/python2.7 /usr/local/lib/python3.5 /usr/local/lib/python2.7 /usr/include/python3.5m /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz whereis python2
python2: /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python2.7-config /usr/lib/python2.7 /etc/python2.7 /usr/local/lib/python2.7 /usr/include/python2.7 /usr/share/man/man1/python2.1.gz whereis python3
python3: /usr/bin/python3.5m /usr/bin/python3 /usr/bin/python3.5 /usr/lib/python3 /usr/lib/python3.5 /etc/python3 /etc/python3.5 /usr/local/lib/python3.5 /usr/include/python3.5m /usr/share/python3 /usr/share/man/man1/python3.1.gz
  1. man

    man 是 Linux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上
man whatis
output a lot
man which
output a lot
man whereis
output a lot
man man
output a lot
man locate
output a lot
man find
output a lot
man type
No manual entry for type
  1. locate

      locate命令不是实时查找,所以查找的结果不精确,但查找速度很快。因为它查找的不是目录,而是一个数据库(/var/lib/locatedb),这个数据库中含有本地所有文件信息。Linux系统自动创建这个数据库,并且每天自动更新一次,所以使用locate命令查不到最新变动过的文件。为了避免这种情况,可以在使用locate之前,先使用updatedb命令,手动更新数据库。
sudo updatedb

locate whatis
output a lot locate which
output a lot locate whereis
/usr/bin/whereis
/usr/share/bash-completion/completions/whereis
/usr/share/man/man1/whereis.1.gz locate man
output a lot locate locate
output a lot locate find
output a lot locate type
output a lot locate passwd
will output a lot locate -n 5 passwd
/etc/passwd
/etc/passwd-
/etc/cron.daily/passwd
/etc/init/passwd.conf
/etc/pam.d/chpasswd locate vim
output a lot
  1. find

      find是最常用和最强大的查找命令。它能做到实时查找,精确查找,但速度慢。

      find的使用格式如下:

      #find [指定目录] [指定条件] [指定动作]

      指定目录:是指所要搜索的目录和其子目录。如果不指定,则默认为当前目录。

      指定条件:是指所要搜索的文件的特点。

      指定动作:是指对搜索的结果如何处理。

      常见选项:

      -name 根据文件名称查找(严格区分大小写,如果文件名中间有空格,则必须把文件名用双引号引起来)

      -iname 根据文件名查找(不区分大小写)

      -regex “PATTERN” 正则表达式匹配

      -user 根据文件属主进行查找

      -group 根据文件属组进行查找

      -uid 根据文件的uid查找

      -gid 根据用户的gid查找

      -nouser 查看所有的没有属主的文件

      -nogroup 查看所有的没有属组的文件
find whatis
find: ‘whatis’: No such file or directory
find which
find: ‘which’: No such file or directory
find whereis
find: ‘whereis’: No such file or directory
find man
find: ‘man’: No such file or directory
find locate
find: ‘locate’: No such file or directory
find find
find: ‘find’: No such file or directory
find type
find: ‘type’: No such file or directory
  1. type

      type命令用来区分某个命令到底是由shell自带的,还是由shell外部的独立二进制文件提供的。如果一个命令是外部命令,那么使用-p参数,会显示该命令的路径,相当于which命令。
type whatis
whatis is hashed (/usr/bin/whatis) type which
which is hashed (/usr/bin/which) type whereis
whereis is hashed (/usr/bin/whereis) type man
man is hashed (/usr/bin/man) type locate
locate is hashed (/usr/bin/locate) type find
find is hashed (/usr/bin/find) type type
type is a shell builtin type cd
cd is a shell builtin type grep
grep is aliased to `grep --color=auto' type cat
cat is /bin/cat type vim
vim is hashed (/usr/bin/vim) type -p vim
/usr/bin/vim type python
python is /usr/bin/python

linux命令中find, which、whereis、locate,有什么区别?的更多相关文章

  1. Linux命令中:rsync和cp之间的区别

    rsync:只拷贝那些更新的文件: cp -u:也可以实现类似效果: 两者都基本可以满足备份的需求: 只是一般情况下,用rsync做这类备份之类的事情,更多见: 在备份的操作中,拷贝,过期文件的删除是 ...

  2. linux命令中which、whereis、locate有什么区别?

    1.find find是最常用和最强大的查找命令.它能做到实时查找,精确查找,但速度慢. find的使用格式如下: #find [指定目录] [指定条件] [指定动作] 指定目录:是指所要搜索的目录和 ...

  3. Linux 命令中 which、whereis、locate 命令的用法

    which 命令 which 命令的作用是,在 PATH 变量指定的路径中搜索可执行文件的所在位置.它一般用来确认系统中是否安装了指定的软件. (1)命令格式 which 可执行文件名称 wherei ...

  4. Linux命令中:rsync和scp之间的区别

    scp是把文件全部复制过去,当文件修改后还是把所有文件复制过去, rsync 第一次是把所有文件同步过去,当文件修改后,只把修改的文件同步过去 rsync -av 10.251.205.8:/usr1 ...

  5. linux 文件查找,which,whereis,locate,find

    linux 文件查找,which,whereis,locate,find 一:which 主要用于查找可执行命令的所在位置: 如图,查找命令 ls的目录: 二:whereis 主要用于查找命令的帮助文 ...

  6. [转帖]Linux命令中特殊符号

    Linux命令中特殊符号 转自:http://blog.chinaunix.net/uid-16946891-id-5088144.html   在shell中常用的特殊符号罗列如下:# ; ;; . ...

  7. linux 版本中 i386/i686/x86-64/pcc 等的区别

    在查看dpdk官方文档的时候,发现有 这样(kernel - devel.x86_64; kernel - devel.ppc64:glibc.i686)这样的安装包信息,收集了点资料来分析这三者的关 ...

  8. linux内核中GNU C和标准C的区别

    linux内核中GNU C和标准C的区别 今天看了一下午的linux内核编程方面的内容,发现linux 内核中GNU C与标准C有一些差别,特记录如下: linux 系统上可用的C编译器是GNU C编 ...

  9. 【Linux命令】Linux命令后面所接选项和参数的区别

    Linux命令后面所接选项和参数的区别 在使用Linux命令时,有时候后面会跟一些"选项"(options)或"参数"(agruments) 命令格式为: #中 ...

随机推荐

  1. Docker安装GitLab与Runner(网关),常规设置,自动化用到k8s+token

    [转]图文详解k8s自动化持续集成之GitLab CI/CD Windows里面使用Debian命令行工具完成 和Docker网络相关的命令 查看某一个容器的网络 docker inspect 容器I ...

  2. Linux之crontab命令

    简介 通过crontab 命令,我们可以在固定的间隔时间执行指定的系统指令或 shell 脚本.时间间隔的单位可以 是分钟.小时.日.月.周及以上的任意组合.这个命令非常适合周期性的日志分析或数据备份 ...

  3. POJ 2509 Peter's smokes(Peter的香烟)

    POJ 2509 Peter的香烟 描述 Peter抽烟.他抽烟一个个地抽着烟头.从 k (k>1) 个烟头中,他可以抽一根新烟.彼得可以抽几支烟? 输入 输入是一系列行.每行包含两个给出n和k ...

  4. Dede后台广告管理模块增加图片上传功能插件

    用户问题:网站广告后台管理非常方便,但是织梦后台的广告管理模块,发布广告时图片没有上传选项,只能用URL地址,很不方便,那么织梦帮就教大家一个方法实现广告图片后台直接上传,非常方便.先给大家看下修改后 ...

  5. P4457-[BJOI2018]治疗之雨【期望dp,高斯消元】

    正题 题目链接:https://www.luogu.com.cn/problem/P4457 题目大意 开始一个人最大生命值为\(n\),剩余\(hp\)点生命,然后每个时刻如果生命值没有满那么有\( ...

  6. 深入浅出WPF-08.Event( 事件)01

    事件(Event) 首先我们来继续说一下UI组件树,因为WPF事件 的路由环境就是组件树.WPF中的树有两种,一种是逻辑树(Logical Tree),一种是可视元素树(Visual Tree).逻辑 ...

  7. Flawfinder在Python2和Python3环境下对代码进行扫描方法

    1. Flawfinder Flawfinder是一款开源的关于C/C++静态扫描分析工具,其根据内部字典数据库进行静态搜索,匹配简单的缺陷与漏洞. 官网:https://dwheeler.com/f ...

  8. Java基础(七)——多线程

    一.概述 1.介绍 Java VM 启动的时候会有一个进程Java.exe,该进程中至少有一个线程负责Java程序的执行.而且这个线程运行的代码存在于main方法中,该线程称之为主线程.其实从细节上来 ...

  9. 【Go】Golang实现gRPC的Proxy的原理

    背景 gRPC是Google开始的一个RPC服务框架, 是英文全名为Google Remote Procedure Call的简称. 广泛的应用在有RPC场景的业务系统中,一些架构中将gRPC请求都经 ...

  10. 《手把手教你》系列技巧篇(三十)-java+ selenium自动化测试- Actions的相关操作下篇(详解教程)

    1.简介 本文主要介绍两个在测试过程中可能会用到的功能:Actions类中的拖拽操作和Actions类中的划取字段操作.例如:需要在一堆log字符中随机划取一段文字,然后右键选择摘取功能. 2.拖拽操 ...