{"id":37,"date":"2018-11-18T18:45:42","date_gmt":"2018-11-18T10:45:42","guid":{"rendered":"http:\/\/47.107.162.66\/?p=37"},"modified":"2020-03-28T21:42:42","modified_gmt":"2020-03-28T13:42:42","slug":"linux","status":"publish","type":"post","link":"https:\/\/harson.co\/index.php\/2018\/11\/18\/linux\/","title":{"rendered":"Linux"},"content":{"rendered":"<h3>\u67e5\u770b\u8fdb\u7a0b\u6240\u5360\u7528\u7684\u7aef\u53e3<\/h3>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">netstat -atunlp<\/code><\/pre>\r\n<p>&nbsp;<\/p>\r\n<h3>\u4fee\u6539\u4e3b\u673a\u540d<\/h3>\r\n<p>\u67e5\u770b\u4e3b\u673a\u540d<\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">hostname<\/code><\/pre>\r\n<p>\u4fee\u6539\u4e3b\u673a\u540d<\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">hostnamectl set-hostname \u4e3b\u673a\u540d<\/code><\/pre>\r\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">vi \/etc\/hostname<\/code><\/pre>\r\n<p>&nbsp;<\/p>\r\n<h3>\u786c\u76d8\u64cd\u4f5c<\/h3>\r\n<p><strong>\u67e5\u770b\u786c\u76d8\u4fe1\u606f<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">fdisk -l<\/code><\/pre>\r\n<p><strong>\u5c1d\u8bd5\u5bf9\u67d0\u4e2a\u786c\u76d8\u8fdb\u884c\u5206\u533a<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">fdisk \/dev\/sda<\/code><\/pre>\r\n<p><strong>\u8f93\u5165m\u67e5\u770b\u5e2e\u52a9\u4fe1\u606f<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">\u5e38\u7528\u7684 -p  \u6253\u5370\u78c1\u76d8\u7684\u5206\u533a\u60c5\u51b5\uff0c-n \u65b0\u589e\u5206\u533a\uff0c-d \u5220\u9664\u5206\u533a\uff0c-w \u5206\u533a\u751f\u6548\uff0c-q \u5206\u533a\u64cd\u4f5c\u53d6\u6d88\r\n\r\n\u65b0\u589e\u5206\u533a\u65f6 \u4f7f\u7528 -n \u521b\u5efa\u5206\u533a\uff1b\u7136\u540e\u9009\u62e9\u5206\u533a\u7c7b\u578b\uff1ap \u4e3b\u5206\u533a\u3001e\u6269\u5c55\u5206\u533a\uff1b\u518d\u8f93\u5165\u5206\u533aID 1~4\u4e0d\u91cd\u590d\u5c31\u597d\uff01\r\n\r\n\u901a\u8fc7-p\u67e5\u770b\u662f\u5426\u5206\u533a\u6210\u529f\r\n\r\n\u6700\u540e-w \u4fdd\u5b58\u5206\u533a<\/code><\/pre>\r\n<p><strong>mount\u547d\u4ee4\u6302\u8f7d\u786c\u76d8<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">mount \/dev\/sda3 \/ST200\r\n#\u5c06 \/dev\/sda3 \u5206\u533a\u6302\u8f7d\u5230 \/ST200\u4e0a<\/code><\/pre>\r\n<p>&nbsp;<\/p>\r\n<p><strong>\u81ea\u52a8\u6302\u8f7d\u786c\u76d8<\/strong><\/p>\r\n<p>1.\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff0c\u67e5\u8be2\u78c1\u76d8\u5206\u533a\u7684UUID\uff0c\u4f8b\u5982\u67e5\u8be2\/dev\/sdb1<\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">sudo blkid \/dev\/sdb1\r\n\r\n\/dev\/sdb1: UUID=\"bb84333a-6a0d-4285-a14c-cf8b5da88d61\" TYPE=\"ext4\"<\/code><\/pre>\r\n<p>2.\u7f16\u8f91\u6587\u4ef6\/etc\/fstab\uff0c\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4e00\u884c<\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">UUID=bb84333a-6a0d-4285-a14c-cf8b5da88d61 \/home\/eason\/data ext4 defaults 0 2<\/code><\/pre>\r\n<h4>\u53c2\u6570\u89e3\u91ca\uff1a<\/h4>\r\n<ul>\r\n<li>UUID=bb84333a-6a0d-4285-a14c-cf8b5da88d61\uff1a\u8981\u6302\u8f7d\u7684\u78c1\u76d8\u5206\u533a\u7684UUID<\/li>\r\n<li>\/home\/eason\/data\uff1a\u6302\u8f7d\u76ee\u5f55<\/li>\r\n<li>ext4\uff1a\u5206\u533a\u683c\u5f0f\u4e3aext4<\/li>\r\n<li>defaults\uff1a\u6302\u8f7d\u65f6\u6240\u8981\u8bbe\u5b9a\u7684\u53c2\u6570(\u53ea\u8bfb\uff0c\u8bfb\u5199\uff0c\u542f\u7528quota\u7b49)\uff0c\u8f93\u5165defaults\u5305\u62ec\u7684\u53c2\u6570\u6709(rw\u3001dev\u3001exec\u3001auto\u3001nouser\u3001async)<\/li>\r\n<li>0\uff1a\u4f7f\u7528dump\u662f\u5426\u8981\u8bb0\u5f55\uff0c0\u4e3a\u4e0d\u9700\u8981\uff0c1\u4e3a\u9700\u8981<\/li>\r\n<li>2\uff1a2\u662f\u5f00\u673a\u65f6\u68c0\u67e5\u7684\u987a\u5e8f\uff0cboot\u7cfb\u7edf\u6587\u4ef6\u4e3a1\uff0c\u5176\u4ed6\u6587\u4ef6\u7cfb\u7edf\u90fd\u4e3a2\uff0c\u5982\u4e0d\u8981\u68c0\u67e5\u5c31\u4e3a0<\/li>\r\n<\/ul>\r\n<p>&nbsp;<\/p>\r\n<h3>\u89e3\u538b\uff1a<\/h3>\r\n<p>tar -xvf file.tar \/\/\u89e3\u538b tar\u5305<\/p>\r\n<p>tar -xzvf file.tar.gz \/\/\u89e3\u538btar.gz<\/p>\r\n<p>unzip file.zip\/\/\u89e3\u538bzip<\/p>\r\n<p>gzip -d file.gz \/\/\u89e3\u538b.gz<\/p>\r\n<h3>\u65e5\u5fd7<\/h3>\r\n<p>Linux \u7cfb\u7edf\u65e5\u5fd7\u4e00\u822c\u90fd\u5728 \/var\/log \u4e0b<\/p>\r\n<p>\u6267\u884c lastlog \uff1a\u67e5\u770b\u6240\u6709\u7528\u6237\u4e0a\u6b21\u767b\u5f55\u60c5\u51b5<\/p>\r\n<p>\u6267\u884clastb\uff1a\u67e5\u770b\u6240\u6709\u5931\u8d25\u767b\u5f55\uff0c\u5185\u5bb9\u4fdd\u5b58\u5728 btmp<\/p>\r\n<p>\/var\/log\/messages :\u7cfb\u7edf\u65e5\u5fd7<\/p>\r\n<p>\/var\/log\/cron \u4e0e\u5b9a\u65f6\u4efb\u52a1\u76f8\u5173\u7684\u65e5\u5fd7\u4fe1\u606f<\/p>\r\n<p>\/var\/log\/secure\u4e0e\u5b89\u5168\u76f8\u5173\u7684\u65e5\u5fd7\u4fe1\u606f<\/p>\r\n<p>\/var\/log\/boot.log \u5b88\u62a4\u8fdb\u7a0b\u542f\u52a8\u548c\u505c\u6b62\u76f8\u5173\u7684\u65e5\u5fd7\u6d88\u606f<\/p>\r\n<h3>\u5386\u53f2<\/h3>\r\n<p>\u547d\u4ee4\u5386\u53f2\u5728\u00a0 \/home\/bash_history<\/p>\r\n<p>\u6216 \/root\/bash_history<\/p>\r\n<p><strong>Vim<\/strong><\/p>\r\n<p>vim\u5f02\u5e38\u9000\u51fa\u4f1a\u751f\u6210<strong>\u9690\u85cf\u6587\u4ef6\u00a0<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">.xxxx.xx.swp<\/code><\/pre>\r\n<p><strong>\u73af\u5883\u53d8\u91cf<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">export a=132\r\n#\u58f0\u660e\u73af\u5883\u53d8\u91cf a=132\r\n<br \/>export a=132 &gt;&gt; \/etc\/profile<br \/>#\u6c38\u4e45\u751f\u6548<br \/>\r\nenv #\u67e5\u8be2\u53d8\u91cf\r\necho $a\r\nunset a\r\n#\u5220\u9664\u53d8\u91cf<br \/><\/code><\/pre>\r\n<p><strong>\u81ea\u5b9a\u4e49\u547d\u4ee4<\/strong><\/p>\r\n<pre class=\"pure-highlightjs\"><code class=\"\">#\u5bb6\u76ee\u5f55\u4e0b.bashrc\r\n\/root\/.bashrc\r\n\r\nalias ll=\"ls -lah\"<\/code><\/pre>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u8fdb\u7a0b\u6240\u5360\u7528\u7684\u7aef\u53e3 netstat -atunlp &nbsp; \u4fee\u6539\u4e3b\u673a\u540d \u67e5\u770b\u4e3b\u673a\u540d hostname  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":13,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":482,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions\/482"}],"wp:attachment":[{"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/harson.co\/index.php\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}