ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÆßÖÖ·½·¨½ÌÄãÔÚubuntuÖеݲװ°üÊÇ·ñÕýÈ·°²×°

·¢²¼Ê±¼ä:2019-06-28 16:24:09À´Ô´:ºìÁª×÷Õß:ÆßÖÖ·½·¨½ÌÄãÔÚubuntuÖеÄ

ÎÒÃǽüÆÚ·¢²¼ÁËһƪ¹ØÓÚÅúÁ¿³ÌÐò°ü°²×°µÄÎÄÕ¡£ÔÚ´Ëͬʱ£¬¹ØÓÚÈçºÎ»ñȡϵͳÉÏÒÑ°²×°Á˵ijÌÐò°üÐÅÏ¢£¬ÎÒÒ²×öÁËЩµ÷²éÈ»ºóÕÒµ½ÁËЩ·½·¨¡£ÎÒ»á°ÑÕâЩ·½·¨·ÖÏíÔÚÎÒÃǵÄÍøÕ¾ÉÏ£¬Ï£ÍûÄÜ°ïÖúµ½ÆäËûÈË¡£


ÓкܶàÖÖ·½·¨¿ÉÒÔ¼ì²é³ÌÐò°üÊÇ·ñÒÑ°²×°£¬ÎÒÕÒµ½ÁË 7 ÖÖÃüÁÄã¿ÉÒÔ´ÓÖÐÑ¡ÔñÄãϲ»¶µÄʹÓá£


ÈçÏ£º


apt-cache£º¿ÉÓÃÓÚ²éѯ APT »º´æ»ò³ÌÐò°üµÄÔªÊý¾Ý¡£

apt£ºÊÇ»ùÓÚ Debian µÄϵͳÖеݲװ¡¢ÏÂÔØ¡¢É¾³ý¡¢ËÑË÷ºÍ¹ÜÀí°üµÄÇ¿ÓÐÁ¦µÄ¹¤¾ß¡£
dpkg-query£ºÒ»¸ö²éѯ dpkg Êý¾Ý¿âµÄ¹¤¾ß¡£
dpkg£º»ùÓÚ Debian µÄϵͳµÄ°ü¹ÜÀí¹¤¾ß¡£
which£º·µ»ØÔÚÖÕ¶ËÖÐÊäÈëÃüÁîʱִÐеĿÉÖ´ÐÐÎļþµÄȫ·¾¶¡£
whereis£º¿ÉÓÃÓÚËÑË÷Ö¸¶¨ÃüÁîµÄ¶þ½øÖÆÎļþ¡¢Ô´ÂëÎļþºÍ°ïÖúÎļþ¡£
locate£º±È find ÃüÁî¿ì£¬ÒòΪÆäʹÓàupdatedb Êý¾Ý¿âËÑË÷£¬¶ø findÃüÁîÔÚʵ¼ÊϵͳÖÐËÑË÷¡£

·½·¨Ò»¡¢Ê¹Óà apt-cache ÃüÁî

apt-cache ÃüÁîÓÃÓÚ´Ó APT ÄÚ²¿Êý¾Ý¿âÖвéѯAPT »º´æºÍ°üµÄÔªÊý¾Ý£¬½«»áËÑË÷ºÍÏÔʾָ¶¨°üµÄÐÅÏ¢£¬°üÀ¨ÊÇ·ñ°²×°¡¢³ÌÐò°ü°æ±¾¡¢Ô´Âë²Ö¿âÐÅÏ¢µÈ¡£


ÏÂÃæµÄʾÀýÇå³þµÄÏÔʾ nano °üÒѾ­ÔÚϵͳÖа²×°ÁËÒÔ¼°¶ÔÓ¦°²×°µÄ°æ±¾ºÅ¡£


# apt-cache policy nano

nano:
  Installed: 2.9.3-2
  Candidate: 2.9.3-2
  Version table:
 *** 2.9.3-2 500
        500 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

·½·¨¶þ¡¢Ê¹Óà apt ÃüÁî

apt ÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄÃüÁîÐй¤¾ß£¬¿ÉÓÃÓÚ°²×°¡¢ÏÂÔØ¡¢É¾³ý¡¢ËÑË÷¡¢¹ÜÀí³ÌÐò°üÒÔ¼°²éѯ¹ØÓÚ³ÌÐò°üµÄÐÅÏ¢£¬ÀàËƶÔÓÚ libapt-pkg ¿âµÄËùÓй¦Äܵĵײã·ÃÎÊ¡£Æä°üº¬Ò»Ð©Óë°ü¹ÜÀíÏà¹ØµÄµ«ºÜÉÙÓõ½µÄÃüÁîÐй¦ÄÜ¡£


# apt -qq list nano

nano/bionic,now 2.9.3-2 amd64 [installed]

·½·¨Èý¡¢Ê¹Óà dpkg-query ÃüÁî

dpkg-query ÊÇÏÔʾ dpkg Êý¾Ý¿âÖгÌÐò°üÐÅÏ¢ÁбíµÄÒ»¸ö¹¤¾ß¡£


ÏÂÃæʾÀýÖеÄÊä³öµÄµÚÒ»ÁÐ ii£¬±íʾ²éѯµÄ³ÌÐò°üÒÑ°²×°ÁË¡£


# dpkg-query --list | grep -i nano

ii  nano    2.9.3-2    amd64    small, friendly text editor inspired by Pico

·½·¨ËÄ¡¢Ê¹Óà dpkg ÃüÁî

dpkg£¨debian package£©ÊÇÒ»¸ö°²×°¡¢¹¹½¨¡¢É¾³ýºÍ¹ÜÀí Debian °üµÄ¹¤¾ß£¬µ«ºÍÆäËû°ü¹ÜÀíϵͳ²»Í¬µÄÊÇ£¬Æä²»ÄÜ×Ô¶¯ÏÂÔغͰ²×°°ü»ò°üÒÀÀµ¡£


ÏÂÃæʾÀýÖеÄÊä³öµÄµÚÒ»ÁÐ ii£¬±íʾ²éѯµÄ°üÒÑ°²×°ÁË¡£


# dpkg -l | grep -i nano
ii  nano     2.9.3-2    amd64   small, friendly text editor inspired by Pico

·½·¨Î塢ʹÓà which ÃüÁî

which ÃüÁî·µ»ØÔÚÖÕ¶ËÖÐÊäÈëÃüÁîʱִÐеĿÉÖ´ÐÐÎļþµÄȫ·¾¶¡£Õâ¶ÔÓÚÄãÏëÒª¸ø¿ÉÖ´ÐÐÎļþ´´½¨×ÀÃæ¿ì½Ý·½Ê½»ò·ûºÅÁ´½Óʱ·Ç³£ÓÐÓá£


which ÃüÁî½öÔÚµ±Ç°Óû§ PATH »·¾³±äÁ¿ÅäÖõÄĿ¼ÁбíÖÐËÑË÷£¬¶ø²»ÊÇÔÚËùÓÐÓû§µÄĿ¼ÖÐËÑË÷¡£ÕâÒâ˼Êǵ±ÄãµÇÈëÄã×Ô¼ºÕ˺Åʱ£¬Æä²»»áÔÚ root Óû§Îļþ»òĿ¼ÖÐËÑË÷¡£


Èç¹û¶ÔÓÚÖ¸¶¨µÄ³ÌÐò°ü»ò¿ÉÖ´ÐÐÎļþ·¾¶ÓÐÈçÏÂÊä³ö£¬Ôò±íʾÒÑ°²×°ÁË£¬·ñÔòûÓС£


# which nano

/bin/nano

·½·¨Áù¡¢Ê¹Óà whereis ÃüÁî

whereis ÃüÁîÓÃÓÚÕë¶ÔÖ¸¶¨ÃüÁîËÑË÷¶ÔÓ¦µÄ³ÌÐò¶þ½øÖÆÎļþ¡¢Ô´ÂëÎļþÒÔ¼°°ïÖúÎļþµÈ¡£


Èç¹û¶ÔÓÚÖ¸¶¨µÄ³ÌÐò°ü»ò¿ÉÖ´ÐÐÎļþ·¾¶ÓÐÈçÏÂÊä³ö£¬Ôò±íʾÒÑ°²×°ÁË£¬·ñÔòûÓС£


# whereis nano

nano: /bin/nano /usr/share/nano /usr/share/man/man1/nano.1.gz /usr/share/info/nano.info.gz

·½·¨Æß¡¢Ê¹Óà locate ÃüÁî

locate ÃüÁî±È find ÃüÁî¿ì£¬ÒòΪÆäÔÚ updatedb Êý¾Ý¿âÖÐËÑË÷£¬¶ø find ÃüÁîÔÚʵ¼ÊϵͳÖнøÐÐËÑË÷¡£


¶ÔÓÚ»ñÈ¡Ö¸¶¨Îļþ£¬ÆäʹÓÃÊý¾Ý¿â¶ø²»ÊÇÔÚÌض¨Ä¿Â¼Â·¾¶ÖÐËÑË÷¡£


locate ÃüÁî²»»áÔ¤°²×°ÔÚ´ó¶àÊýϵͳÖУ¬ÐèÒªÊÖ¶¯°²×°¡£


locate ʹÓõÄÊý¾Ý¿â»á¸ù¾Ý¶¨Ê±ÈÎÎñ¶¨ÆÚ¸üС£µ±È»£¬ÎÒÃÇÒ²¿ÉÒÔÊÖ¶¯¸üС£


Èç¹û¶ÔÓÚÖ¸¶¨µÄ³ÌÐò°ü»ò¿ÉÖ´ÐÐÎļþ·¾¶ÓÐÈçÏÂÊä³ö£¬Ôò±íʾÒÑ°²×°ÁË£¬·ñÔòûÓС£


# locate --basename '
ano'
/usr/bin/nano
/usr/share/nano
/usr/share/doc/nano


ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ