当前位置: 技术问答>linux和unix
关于whereis和locate的区别《研究贴,不喜勿进》
来源: 互联网 发布时间:2016-07-28
本文导语: locate使用自己的一个数据库,使用updatedb来更新文件系统 但是whereis呢?我在网上搜索的结果是whereis: will search only particular paths to find binaries and or manpages. whereis then attempts to locate the desired program in a list...
locate使用自己的一个数据库,使用updatedb来更新文件系统
但是whereis呢?我在网上搜索的结果是whereis: will search only particular paths to find binaries and or manpages.
whereis then attempts to locate the desired program in a list of standard Linux places.
a list of standard Linux places具体指的是哪里???
但是whereis呢?我在网上搜索的结果是whereis: will search only particular paths to find binaries and or manpages.
whereis then attempts to locate the desired program in a list of standard Linux places.
a list of standard Linux places具体指的是哪里???
|
跟据util-linux-ng-2.16
whereis.c的源码,在缺省的情况下,会找当前和以下的路径
static char *bindirs[] = {
"/bin",
"/usr/bin",
"/sbin",
"/usr/sbin",
"/etc",
"/usr/etc",
"/lib",
"/usr/lib",
"/lib64",
"/usr/lib64",
"/usr/games",
"/usr/games/bin",
"/usr/games/lib",
"/usr/emacs/etc",
"/usr/lib/emacs/*/etc",
"/usr/TeX/bin",
"/usr/tex/bin",
"/usr/interviews/bin/LINUX",
"/usr/X11R6/bin",
"/usr/X386/bin",
"/usr/bin/X11",
"/usr/X11/bin",
"/usr/X11R5/bin",
"/usr/local/bin",
"/usr/local/sbin",
"/usr/local/etc",
"/usr/local/lib",
"/usr/local/games",
"/usr/local/games/bin",
"/usr/local/emacs/etc",
"/usr/local/TeX/bin",
"/usr/local/tex/bin",
"/usr/local/bin/X11",
"/usr/contrib",
"/usr/hosts",
"/usr/include",
"/usr/g++-include",
"/usr/ucb",
"/usr/old",
"/usr/new",
"/usr/local",
"/usr/libexec",
"/usr/share",
"/opt/*/bin",
0
};
static char *mandirs[] = {
"/usr/man/*",
"/usr/share/man/*",
"/usr/X386/man/*",
"/usr/X11/man/*",
"/usr/TeX/man/*",
"/usr/interviews/man/mann",
0
};
static char *srcdirs[] = {
"/usr/src/*",
"/usr/src/lib/libc/*",
"/usr/src/lib/libc/net/*",
"/usr/src/ucb/pascal",
"/usr/src/ucb/pascal/utilities",
"/usr/src/undoc",
0
};
whereis.c的源码,在缺省的情况下,会找当前和以下的路径
static char *bindirs[] = {
"/bin",
"/usr/bin",
"/sbin",
"/usr/sbin",
"/etc",
"/usr/etc",
"/lib",
"/usr/lib",
"/lib64",
"/usr/lib64",
"/usr/games",
"/usr/games/bin",
"/usr/games/lib",
"/usr/emacs/etc",
"/usr/lib/emacs/*/etc",
"/usr/TeX/bin",
"/usr/tex/bin",
"/usr/interviews/bin/LINUX",
"/usr/X11R6/bin",
"/usr/X386/bin",
"/usr/bin/X11",
"/usr/X11/bin",
"/usr/X11R5/bin",
"/usr/local/bin",
"/usr/local/sbin",
"/usr/local/etc",
"/usr/local/lib",
"/usr/local/games",
"/usr/local/games/bin",
"/usr/local/emacs/etc",
"/usr/local/TeX/bin",
"/usr/local/tex/bin",
"/usr/local/bin/X11",
"/usr/contrib",
"/usr/hosts",
"/usr/include",
"/usr/g++-include",
"/usr/ucb",
"/usr/old",
"/usr/new",
"/usr/local",
"/usr/libexec",
"/usr/share",
"/opt/*/bin",
0
};
static char *mandirs[] = {
"/usr/man/*",
"/usr/share/man/*",
"/usr/X386/man/*",
"/usr/X11/man/*",
"/usr/TeX/man/*",
"/usr/interviews/man/mann",
0
};
static char *srcdirs[] = {
"/usr/src/*",
"/usr/src/lib/libc/*",
"/usr/src/lib/libc/net/*",
"/usr/src/ucb/pascal",
"/usr/src/ucb/pascal/utilities",
"/usr/src/undoc",
0
};