{"id":3225,"date":"2019-06-15T23:50:44","date_gmt":"2019-06-15T15:50:44","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=3225"},"modified":"2022-05-18T15:50:13","modified_gmt":"2022-05-18T07:50:13","slug":"hash","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/hash","title":{"rendered":"hash\u547d\u4ee4 – \u7ba1\u7406\u547d\u4ee4\u8fd0\u884c\u65f6\u67e5\u8be2\u7684\u54c8\u5e0c\u8868"},"content":{"rendered":"\n

hash\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cHash Algorithm\u201d\u7684\u7f29\u5199\uff0c\u4e2d\u6587\u8bd1\u4e3a\u54c8\u5e0c\u7b97\u6cd5\u6216\u6742\u51d1\u7b97\u6cd5\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u7ba1\u7406\u547d\u4ee4\u8fd0\u884c\u65f6\u67e5\u8be2\u7684\u54c8\u5e0c\u8868\u3002hash\u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u4e0e\u5220\u9664\u547d\u4ee4\u8fd0\u884c\u65f6\u7cfb\u7edf\u67e5\u8be2\u7684\u54c8\u5e0c\u8868\u4fe1\u606f\uff0c\u5982\u679c\u4e0d\u52a0\u4efb\u4f55\u53c2\u6570\uff0c\u5219\u4f1a\u9ed8\u8ba4\u8f93\u51fa\u8def\u5f84\u5217\u8868\u7684\u4fe1\u606f\uff0c\u8fd9\u4efd\u5217\u8868\u4f1a\u5305\u542b\u5148\u524dhash\u547d\u4ee4\u8c03\u7528\u627e\u5230\u7684Shell\u73af\u5883\u4e2d\u547d\u4ee4\u7684\u8def\u5f84\u540d\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f: <\/strong> hash [\u53c2\u6570] [\u76ee\u5f55] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a\ufeff<\/strong><\/p>\n\n\n\n

-d<\/td>\u5728\u54c8\u5e0c\u8868\u4e2d\u6e05\u9664\u8bb0\u5f55<\/td><\/tr>
-l<\/td>\u663e\u793a\u54c8\u5e0c\u8868\u4e2d\u7684\u547d\u4ee4<\/td><\/tr>
-p<\u6307\u4ee4><\/td>\u5c06\u5177\u6709\u5b8c\u6574\u8def\u5f84\u7684\u547d\u4ee4\u52a0\u5165\u5230\u54c8\u5e0c\u8868\u4e2d<\/td><\/tr>
-r<\/td>\u6e05\u9664\u54c8\u5e0c\u8868\u4e2d\u7684\u8bb0\u5f55<\/td><\/tr>
-t<\/td>\u663e\u793a\u54c8\u5e0c\u8868\u4e2d\u547d\u4ee4\u7684\u5b8c\u6574\u8def\u5f84<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u663e\u793a\u54c8\u5e0c\u8868\u4e2d\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hash -l<\/strong>\nbuiltin hash -p \/usr\/sbin\/ifconfig ifconfig\nbuiltin hash -p \/usr\/bin\/cat cat\nbuiltin hash -p \/usr\/bin\/pidof pidof<\/pre>\n\n\n\n

\u5220\u9664\u54c8\u5e0c\u8868\u4e2d\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hash -r <\/strong><\/pre>\n\n\n\n

\u5411\u54c8\u5e0c\u8868\u4e2d\u6dfb\u52a0\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hash -p \/usr\/sbin\/adduser myadduser <\/strong><\/pre>\n\n\n\n

\u5728\u54c8\u5e0c\u8868\u4e2d\u6e05\u9664\u8bb0\u5f55\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hash -d<\/strong>\nhits\tcommand\n   0\t\/usr\/sbin\/adduser\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

hash\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cHash Algorithm\u201d\u7684\u7f29\u5199\uff0c\u4e2d\u6587\u8bd1\u4e3a\u54c8\u5e0c\u7b97\u6cd5\u6216\u6742\u51d1\u7b97\u6cd5\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u7ba1\u7406 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3225"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=3225"}],"version-history":[{"count":7,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3225\/revisions"}],"predecessor-version":[{"id":9853,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3225\/revisions\/9853"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=3225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=3225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=3225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}