{"id":3229,"date":"2019-06-24T09:45:52","date_gmt":"2019-06-24T01:45:52","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=3229"},"modified":"2022-05-12T21:50:57","modified_gmt":"2022-05-12T13:50:57","slug":"history","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/history","title":{"rendered":"history\u547d\u4ee4 – \u663e\u793a\u4e0e\u7ba1\u7406\u5386\u53f2\u547d\u4ee4\u8bb0\u5f55"},"content":{"rendered":"\n

history\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u5355\u8bcd\u5386\u53f2\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u4e0e\u7ba1\u7406\u5386\u53f2\u547d\u4ee4\u8bb0\u5f55\u3002Linux\u7cfb\u7edf\u9ed8\u8ba4\u4f1a\u8bb0\u5f55\u7528\u6237\u6240\u6267\u884c\u8fc7\u7684\u6240\u6709\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528history\u547d\u4ee4\u67e5\u9605\u5b83\u4eec\uff0c\u4e5f\u53ef\u4ee5\u5bf9\u5176\u8bb0\u5f55\u8fdb\u884c\u4fee\u6539\u548c\u5220\u9664\u64cd\u4f5c\u3002<\/p>\n\n\n\n

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

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

-a<\/td>\u5199\u5165\u547d\u4ee4\u8bb0\u5f55<\/td><\/tr>
-c<\/td>\u6e05\u7a7a\u547d\u4ee4\u8bb0\u5f55<\/td><\/tr>
-d<\/td>\u5220\u9664\u6307\u5b9a\u5e8f\u53f7\u7684\u547d\u4ee4\u8bb0\u5f55<\/td><\/tr>
-n<\/td>\u8bfb\u53d6\u547d\u4ee4\u8bb0\u5f55<\/td><\/tr>
-r<\/td>\u8bfb\u53d6\u547d\u4ee4\u8bb0\u5f55\u5230\u7f13\u51b2\u533a<\/td><\/tr>
-s<\/td>\u5c06\u6307\u5b9a\u7684\u547d\u4ee4\u6dfb\u52a0\u5230\u7f13\u51b2\u533a<\/td><\/tr>
-w<\/td>\u5c06\u7f13\u51b2\u533a\u4fe1\u606f\u5199\u5165\u5230\u5386\u53f2\u6587\u4ef6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

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

\u663e\u793a\u6267\u884c\u8fc7\u7684\u5168\u90e8\u547d\u4ee4\u8bb0\u5f55\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# history <\/strong>\r\n    1  vim \/etc\/sysconfig\/network-scripts\/ifcfg-ens160 \r\n    2  reboot\r\n    3  vim \/etc\/sysconfig\/network-scripts\/ifcfg-ens160\r\n    4  vim \/etc\/yum.repos.d\/rhel.repo\r\n    5  mkdir \/media\/cdrom\r\n    6  vim \/etc\/fstab\r\n    7  reboot\r\n    8  ping 192.168.10.10\r\n    9  dnf install httpd\r\n   10  exit\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026<\/pre>\n\n\n\n

\u663e\u793a\u6267\u884c\u8fc7\u7684\u6700\u8fd15\u6761\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# history 5<\/strong>\r\n   11  exit\n   12  ifconfig\r\n   13  vim \/etc\/hostname \r\n   14  reboot\r\n   15  history\r<\/pre>\n\n\n\n

\u5c06\u672c\u6b21\u7f13\u5b58\u533a\u4fe1\u606f\u5199\u5165\u5230\u5386\u53f2\u6587\u4ef6\u4e2d\uff08~\/.bash_history\uff09\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# history -w<\/strong><\/pre>\n\n\n\n

\u5c06\u5386\u53f2\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\u8bfb\u5165\u5230\u5f53\u524d\u7f13\u51b2\u533a\u4e2d\uff1a<\/p>\n\n\n\n

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

\u5c06\u672c\u6b21\u7f13\u51b2\u533a\u4fe1\u606f\u8ffd\u52a0\u5199\u5165\u5230\u5386\u53f2\u6587\u4ef6\u4e2d\uff08~\/.bash_history\uff09\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# history -a  <\/strong><\/pre>\n\n\n\n

\u6e05\u7a7a\u672c\u6b21\u7f13\u51b2\u533a\u53ca\u5386\u53f2\u6587\u4ef6\u4e2d\u7684\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# history -c <\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"

history\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u5355\u8bcd\u5386\u53f2\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u4e0e\u7ba1\u7406\u5386\u53f2\u547d\u4ee4\u8bb0\u5f55\u3002Linux\u7cfb\u7edf\u9ed8\u8ba4\u4f1a\u8bb0\u5f55\u7528\u6237\u6240\u6267\u884c\u8fc7 […]<\/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\/3229"}],"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=3229"}],"version-history":[{"count":10,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3229\/revisions"}],"predecessor-version":[{"id":9615,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3229\/revisions\/9615"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=3229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=3229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=3229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}