H. Linux查找文件 whereis locate which

[root@hadoop01 ~]# whereis cat
cat: /bin/cat /usr/share/man/man1/cat.1.gz
[root@hadoop01 ~]# yum install mlocate
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
base                                                                                                                                                | 3.7 kB     00:00     
extras                                                                                                                                              | 3.4 kB     00:00     
updates                                                                                                                                             | 3.4 kB     00:00     
updates/primary_db                                                                                                                                  | 1.2 MB     00:01     
解决依赖关系
--> 执行事务检查
---> Package mlocate.x86_64 0:0.22.2-6.el6 will be 安装
--> 完成依赖关系计算

依赖关系解决

===========================================================================================================================================================================
 软件包                                  架构                                   版本                                            仓库                                  大小
===========================================================================================================================================================================
正在安装:
 mlocate                                 x86_64                                 0.22.2-6.el6                                    base                                  86 k

事务概要
===========================================================================================================================================================================
Install       1 Package(s)

总下载量:86 k
Installed size: 279 k
确定吗?[y/N]:y
下载软件包:
mlocate-0.22.2-6.el6.x86_64.rpm                                                                                                                     |  86 kB     00:00     
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
  正在安装   : mlocate-0.22.2-6.el6.x86_64                                                                                                                             1/1 
  Verifying  : mlocate-0.22.2-6.el6.x86_64                                                                                                                             1/1 

已安装:
  mlocate.x86_64 0:0.22.2-6.el6                                                                                                                                            

完毕!
[root@hadoop01 ~]# locate udisk
locate: can not stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录
[root@hadoop01 ~]# locate abc.txt
locate: can not stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录
[root@hadoop01 ~]# updatedb
[root@hadoop01 ~]# locate abc.txt
/mnt/udisk/abc.txt
[root@hadoop01 ~]# locate udisk
/mnt/udisk
/mnt/udisk/abc.txt
[root@hadoop01 ~]# 
[root@hadoop01 ~]# echo $PATH
/opt/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@hadoop01 ~]# which PATH
/usr/bin/which: no PATH in (/opt/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

[root@hadoop01 ~]# ll -a /bin
总用量 6308
dr-xr-xr-x.  2 root root   4096 7月  28 19:57 .
dr-xr-xr-x. 22 root root   4096 8月  31 06:12 ..
-rwxr-xr-x.  1 root root  24232 3月  23 2017 arch
lrwxrwxrwx.  1 root root      4 7月  28 19:56 awk -> gawk
-rwxr-xr-x.  1 root root  23720 3月  23 2017 basename
-rwxr-xr-x.  1 root root 906568 3月  23 2017 bash
-rwxr-xr-x.  1 root root  45224 3月  23 2017 cat
-rwxr-xr-x.  1 root root  52936 3月  23 2017 chgrp
-rwxr-xr-x.  1 root root  48712 3月  23 2017 chmod
-rwxr-xr-x.  1 root root  53640 3月  23 2017 chown
-rwxr-xr-x.  1 root root 116824 3月  23 2017 cp
-rwxr-xr-x.  1 root root 129992 3月  22 2017 cpio
-rwxr-xr-x.  1 root root  41704 3月  23 2017 cut
-rwxr-xr-x.  1 root root 106216 10月 17 2012 dash
-rwxr-xr-x.  1 root root  55576 3月  23 2017 date
-rwxr-xr-x.  1 root root   9144 4月  22 2015 dbus-cleanup-sockets
-rwxr-xr-x.  1 root root 339080 4月  22 2015 dbus-daemon
-rwxr-xr-x.  1 root root  13792 4月  22 2015 dbus-monitor
-rwxr-xr-x.  1 root root  17336 4月  22 2015 dbus-send
-rwxr-xr-x.  1 root root   6776 4月  22 2015 dbus-uuidgen
-rwxr-xr-x.  1 root root  52720 3月  23 2017 dd
-rwxr-xr-x.  1 root root  90544 3月  23 2017 df
-rwxr-xr-x.  1 root root   6736 3月  22 2017 dmesg
lrwxrwxrwx.  1 root root      8 7月  28 19:56 dnsdomainname -> hostname
lrwxrwxrwx.  1 root root      8 7月  28 19:56 domainname -> hostname
-rwxr-xr-x.  1 root root  78504 11月 12 2010 dumpkeys
-rwxr-xr-x.  1 root root  24136 3月  23 2017 echo
lrwxrwxrwx.  1 root root      4 7月  28 19:56 egrep -> grep
-rwxr-xr-x.  1 root root  23832 3月  23 2017 env
lrwxrwxrwx.  1 root root      2 7月  28 19:56 ex -> vi
-rwxr-xr-x.  1 root root  21112 3月  23 2017 false
lrwxrwxrwx.  1 root root      4 7月  28 19:56 fgrep -> grep
-rwxr-xr-x.  1 root root 234512 3月   1 2016 find
-rwxr-xr-x.  1 root root  36392 3月  22 2017 findmnt
-rwxr-xr-x.  1 root root 375616 11月 10 2015 gawk
-rwxr-xr-x.  1 root root 163696 3月  22 2017 grep
lrwxrwxrwx.  1 root root      3 7月  28 19:56 gtar -> tar
-rwxr-xr-x.  1 root root     61 3月  22 2017 gunzip
-rwxr-xr-x.  1 root root  64688 3月  22 2017 gzip
-rwxr-xr-x.  1 root root  13880 3月  22 2017 hostname
-rwxr-xr-x.  1 root root  11264 3月  23 2017 ipcalc
lrwxrwxrwx.  1 root root     41 7月  28 19:57 iptables-xml -> /etc/alternatives/bin-iptables-xml.x86_64
lrwxrwxrwx.  1 root root     20 7月  28 19:57 iptables-xml-1.4.7 -> /sbin/iptables-multi
-rwxr-xr-x.  1 root root   7920 11月 12 2010 kbd_mode
-rwxr-xr-x.  1 root root  11576 3月  22 2017 kill
-rwxr-xr-x.  1 root root  23720 3月  23 2017 link
-rwxr-xr-x.  1 root root  45664 3月  23 2017 ln
-rwxr-xr-x.  1 root root 108248 11月 12 2010 loadkeys
-rwxr-xr-x.  1 root root  11608 3月  22 2017 logger
-rwxr-xr-x.  1 root root  28072 3月  22 2017 login
-rwxr-xr-x.  1 root root 109208 3月  23 2017 ls
-rwxr-xr-x.  1 root root  55336 3月  22 2017 lsblk
-rwxr-xr-x.  1 root root  45384 3月  23 2017 mkdir
-rwxr-xr-x.  1 root root  28568 3月  23 2017 mknod
-rwxr-xr-x.  1 root root  33544 3月  23 2017 mktemp
-rwxr-xr-x.  1 root root  35928 3月  22 2017 more
-rwsr-xr-x.  1 root root  77560 3月  22 2017 mount
-rwxr-xr-x.  1 root root   6728 7月  24 2015 mountpoint
-rwxr-xr-x.  1 root root 106912 3月  23 2017 mv
-rwxr-xr-x.  1 root root 123360 3月  22 2017 netstat
-rwxr-xr-x.  1 root root  25208 3月  23 2017 nice
lrwxrwxrwx.  1 root root      8 7月  28 19:56 nisdomainname -> hostname
-rwsr-xr-x.  1 root root  38520 3月  22 2017 ping
-rwsr-xr-x.  1 root root  36488 3月  22 2017 ping6
-rwxr-xr-x.  1 root root  31776 3月  22 2017 plymouth
-rwxr-xr-x.  1 root root  85304 3月  22 2017 ps
-rwxr-xr-x.  1 root root  28008 3月  23 2017 pwd
-rwxr-xr-x.  1 root root   8184 3月  22 2017 raw
-rwxr-xr-x.  1 root root  36360 3月  23 2017 readlink
-rwxr-xr-x.  1 root root  53592 3月  23 2017 rm
-rwxr-xr-x.  1 root root  36888 3月  23 2017 rmdir
-rwxr-xr-x.  1 root root  20392 5月  11 2016 rpm
lrwxrwxrwx.  1 root root      2 7月  28 19:56 rvi -> vi
lrwxrwxrwx.  1 root root      2 7月  28 19:56 rview -> vi
-rwxr-xr-x.  1 root root  69624 6月  22 2012 sed
-rwxr-xr-x.  1 root root  37448 11月 12 2010 setfont
lrwxrwxrwx.  1 root root      4 7月  28 19:56 sh -> bash
-rwxr-xr-x.  1 root root  24264 3月  23 2017 sleep
-rwxr-xr-x.  1 root root  93496 3月  23 2017 sort
-rwxr-xr-x.  1 root root  61320 3月  23 2017 stty
-rwsr-xr-x.  1 root root  34904 3月  23 2017 su
-rwxr-xr-x.  1 root root  21896 3月  23 2017 sync
-rwxr-xr-x.  1 root root 390616 7月  12 2016 tar
-rwxr-xr-x.  1 root root  11352 3月  22 2017 taskset
-rwxr-xr-x.  1 root root  47928 3月  23 2017 touch
-rwxr-xr-x.  1 root root  11440 3月  22 2017 tracepath
-rwxr-xr-x.  1 root root  12304 3月  22 2017 tracepath6
-rwxr-xr-x.  1 root root  21112 3月  23 2017 true
-rwsr-xr-x.  1 root root  53480 3月  22 2017 umount
-rwxr-xr-x.  1 root root  24232 3月  23 2017 uname
-rwxr-xr-x.  1 root root   2555 11月 12 2010 unicode_start
-rwxr-xr-x.  1 root root    363 11月 12 2010 unicode_stop
-rwxr-xr-x.  1 root root  22216 3月  23 2017 unlink
-rwxr-xr-x.  1 root root   6736 3月  23 2017 usleep
-rwxr-xr-x.  1 root root 907248 12月 22 2016 vi
lrwxrwxrwx.  1 root root      2 7月  28 19:56 view -> vi
lrwxrwxrwx.  1 root root      8 7月  28 19:56 ypdomainname -> hostname
-rwxr-xr-x.  1 root root     62 3月  22 2017 zcat
[root@hadoop01 ~]# which cat
/bin/cat

你可能感兴趣的:(H. Linux查找文件 whereis locate which)