• Linux: 查看软件安装路径


    一.        Which 命令

    Shell 的which 命令可以找出相关命令是否已经在搜索路径中。 如:

    [root@localhost ~]# which gcc

    /usr/bin/gcc

    二.        Whereis 命令

    Whereis 命令搜索更大范围的系统目录,和Shell 的搜索路径无关。 要注意,有些系统上的which 命令不显示用户没有执行权限的文件。

    [root@localhost ~]# which ipppd

    /sbin/ipppd

    [root@localhost ~]# whereis ipppd

    ipppd: /sbin/ipppd /usr/sbin/ipppd /usr/share/man/man8/ipppd.8.gz

    三.        Locate 命令

    该命令会先考察预先编译好的一个文件系统的索引,以此确定与特定模式相匹配的文件名。 它搜索的并不特定与命令或者软件包,而是能够找到的任何类型的文件。

    Locate 的数据库库通常由updatedb 命令在每天晚上重新生成,这个命令由cron来运行。 因此,执行一次locate 的结果不是总能够反映出文件系统新近的变化。

    比如查看头文件signal.h

    [oracle@localhost ~]$ locate signal.h

    warning: locate: could not open database: /var/lib/slocate/slocate.db: No such file or directory

    warning: You need to run the 'updatedb' command (as root) to create the database.

    Please have a look at /etc/updatedb.conf to enable the daily cron job.

    [oracle@localhost ~]$ su - root

    Password:

    [root@localhost ~]# updatedb

    [root@localhost ~]# locate signal.h

    /usr/src/kernels/2.6.9-78.EL-i686/include/linux/signal.h

    /usr/src/kernels/2.6.9-78.EL-i686/include/asm-i386/signal.h

    /usr/src/kernels/2.6.9-78.EL-smp-i686/include/linux/signal.h

    /usr/src/kernels/2.6.9-78.EL-smp-i686/include/asm-i386/signal.h

    /usr/src/kernels/2.6.9-78.EL-hugemem-i686/include/linux/signal.h

    /usr/src/kernels/2.6.9-78.EL-hugemem-i686/include/asm-i386/signal.h

    /usr/share/doc/SDL-devel-1.2.7/html/sdlcondsignal.html

    /usr/share/man/man0p/signal.h.0p.gz

    /usr/include/valgrind/pub_tool_libcsignal.h

    /usr/include/asm/signal.h

    /usr/include/sys/signal.h

    /usr/include/linux/signal.h

    /usr/include/glib-2.0/gobject/gsignal.h

    /usr/include/boost/signal.hpp

    /usr/include/signal.h

  • 相关阅读:
    洛谷 P1781 宇宙总统
    洛谷 P2524 Uim的情人节礼物·其之弐(康拓展开)
    洛谷 P1123 取数游戏
    洛谷 P4147 玉蟾宫 & P1169 [ZJOI2007]棋盘制作(求最大子矩阵)
    洛谷 P1387 最大正方形 & P2701 [USACO5.3]巨大的牛棚Big Barn (求最大子正方形)
    洛谷 P1464 Function
    洛谷 P1217 [USACO1.5]回文质数 Prime Palindromes
    洛谷 P1160 队列安排
    洛谷 P1451 求细胞数量
    洛谷 P1914 小书童——密码
  • 原文地址:https://www.cnblogs.com/limeng951/p/5726000.html
Copyright © 2020-2023  润新知