{"id":800,"date":"2022-06-10T18:01:03","date_gmt":"2022-06-10T10:01:03","guid":{"rendered":"http:\/\/loveuhouse.cn\/wordpress\/?p=800"},"modified":"2022-06-10T18:01:19","modified_gmt":"2022-06-10T10:01:19","slug":"%e5%b8%b8%e7%94%a8linux%e6%8c%87%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/loveuhouse.cn\/wordpress\/?p=800","title":{"rendered":"\u5e38\u7528linux\u6307\u4ee4"},"content":{"rendered":"<p>\u539f\u6587\uff1a <a href=\"https:\/\/www.linuxprobe.com\/basic-learning-02.html\" title=\"\u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b\">\u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b<\/a><\/p>\n<p><strong>man [\u6307\u4ee4]<\/strong><br \/>\n\u5e2e\u52a9\u6587\u6863<\/p>\n<table>\n<thead>\n<tr>\n<th>\u6309\u952e<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u7a7a\u683c\u952e<\/td>\n<td>\u5411\u4e0b\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>Page down<\/td>\n<td>\u5411\u4e0b\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>Page up<\/td>\n<td>\u5411\u4e0a\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>home<\/td>\n<td>\u76f4\u63a5\u524d\u5f80\u9996\u9875<\/td>\n<\/tr>\n<tr>\n<td>end<\/td>\n<td>\u76f4\u63a5\u524d\u5f80\u5c3e\u9875<\/td>\n<\/tr>\n<tr>\n<td>\/<\/td>\n<td>\u4ece\u4e0a\u5411\u4e0b\u641c\u7d22\u5982\uff1a\/linux<\/td>\n<\/tr>\n<tr>\n<td>?<\/td>\n<td>\u4ece\u4e0b\u5411\u4e0a\u641c\u7d22\u5982\uff1a?linux<\/td>\n<\/tr>\n<tr>\n<td>n<\/td>\n<td>\u5b9a\u4f4d\u5230\u4e0b\u4e00\u4e2a\u641c\u7d22\u5230\u7684\u5173\u952e\u8bcd<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>\u5b9a\u4f4d\u5230\u4e0a\u4e00\u4e2a\u641c\u7d22\u5230\u7684\u5173\u952e\u8bcd<\/td>\n<\/tr>\n<tr>\n<td>q<\/td>\n<td>\u9000\u51fa\u5e2e\u52a9\u6587\u6863<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Ctrl + d<\/strong><br \/>\n\u8868\u793a\u952e\u76d8\u8f93\u5165\u7ed3\u675f<\/p>\n<p><strong>Ctrl + l<\/strong> (\u5c0f\u5199L)<br \/>\n\u6e05\u5c4f<\/p>\n<p><strong>echo [\u5b57\u7b26\u4e32] [$\u53d8\u91cf]<\/strong><br \/>\n\u8f93\u51fa\u5230\u7ec8\u7aef\uff0c\u5e38\u7528\u4e8e\u8f93\u51fa\u5b57\u7b26\u4e32\u3001\u53d8\u91cf<\/p>\n<pre><code>[root@VM-4-13-centos ~]# echo &quot;hello world&quot;\nhello world\n[root@VM-4-13-centos ~]# echo $SHELL\n\/bin\/bash\n<\/code><\/pre>\n<p><strong>date [+\u6307\u5b9a\u683c\u5f0f]<\/strong><br \/>\n\u5e38\u7528\u4e8e\u8bbe\u7f6e\u3001\u663e\u793a\u7cfb\u7edf\u7684\u65f6\u95f4\u4e0e\u65e5\u671f<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>%S<\/td>\n<td>\u79d2\uff0800~59\uff09<\/td>\n<\/tr>\n<tr>\n<td>%M<\/td>\n<td>\u5206\u949f\uff0800~59\uff09<\/td>\n<\/tr>\n<tr>\n<td>%H<\/td>\n<td>\u5c0f\u65f6\uff0800~23\uff09<\/td>\n<\/tr>\n<tr>\n<td>%I<\/td>\n<td>\u5c0f\u65f6\uff0800~12\uff09<\/td>\n<\/tr>\n<tr>\n<td>%m<\/td>\n<td>\u6708\u4efd\uff081~12\uff09<\/td>\n<\/tr>\n<tr>\n<td>%p<\/td>\n<td>\u663e\u793aAM\u6216PM<\/td>\n<\/tr>\n<tr>\n<td>%a<\/td>\n<td>\u7f29\u5199\u7684\u5de5\u4f5c\u65e5\u540d\u79f0\u5982\uff1aSun<\/td>\n<\/tr>\n<tr>\n<td>%A<\/td>\n<td>\u5b8c\u6574\u7684\u5de5\u4f5c\u65e5\u540d\u79f0\u5982\uff1aSunday<\/td>\n<\/tr>\n<tr>\n<td>%b<\/td>\n<td>\u7f29\u5199\u7684\u6708\u4efd\u540d\u79f0\u5982\uff1aJan<\/td>\n<\/tr>\n<tr>\n<td>%B<\/td>\n<td>\u5b8c\u6574\u7684\u6708\u4efd\u540d\u79f0\u5982\uff1aJanuary<\/td>\n<\/tr>\n<tr>\n<td>%q<\/td>\n<td>\u5b63\u5ea6\uff081~4\uff09<\/td>\n<\/tr>\n<tr>\n<td>%y<\/td>\n<td>\u7b80\u5199\u5e74\u4efd\u5982\uff1a20<\/td>\n<\/tr>\n<tr>\n<td>%Y<\/td>\n<td>\u5b8c\u6574\u5e74\u4efd\u5982\uff1a2020<\/td>\n<\/tr>\n<tr>\n<td>%d<\/td>\n<td>\u672c\u6708\u4e2d\u7684\u7b2c\u51e0\u5929<\/td>\n<\/tr>\n<tr>\n<td>%j<\/td>\n<td>\u4eca\u5e74\u4e2d\u7684\u7b2c\u51e0\u5929<\/td>\n<\/tr>\n<tr>\n<td>%n<\/td>\n<td>\u6362\u884c\u7b26 \u56de\u8f66<\/td>\n<\/tr>\n<tr>\n<td>%t<\/td>\n<td>\u8df3\u683c tab<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6309\u9ed8\u8ba4\u683c\u5f0f\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\u7684\u547d\u4ee4\u5982\u4e0b<\/p>\n<pre><code>[root@VM-4-13-centos ~]# date\nSat Sep 5 09:13:45 CST 2020<\/code><\/pre>\n<p>\u6309 \u5e74-\u6708-\u65e5 \u65f6\uff1a\u5206\uff1a\u79d2 \u7684\u683c\u5f0f\u67e5\u770b\u7684\u547d\u4ee4\u5982\u4e0b<\/p>\n<pre><code>[root@VM-4-13-centos ~]# date &quot;+%Y-%m-%d %H:%M:%S&quot;\n2022-06-10 14:02:39<\/code><\/pre>\n<p><strong>timedatectl [\u53c2\u6570]<\/strong><br \/>\n\u7528\u4e8e\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4\uff0c\u5e38\u7528\u4e8e\u4fee\u6539\u65f6\u533a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>status<\/td>\n<td>\u663e\u793a\u72b6\u6001\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>list-timezones<\/td>\n<td>\u5217\u51fa\u5df2\u77e5\u65f6\u533a<\/td>\n<\/tr>\n<tr>\n<td>set-time<\/td>\n<td>\u8bbe\u7f6e\u7cfb\u7edf\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>set-timezone<\/td>\n<td>\u8bbe\u7f6e\u751f\u6548\u65f6\u533a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code>[root@VM-4-13-centos ~]# timedatectl status\n      Local time: Fri 2022-06-10 14:12:31 CST\n  Universal time: Fri 2022-06-10 06:12:31 UTC\n        RTC time: Fri 2022-06-10 06:12:30\n       Time zone: Asia\/Shanghai (CST, +0800)\n     NTP enabled: no\nNTP synchronized: yes\n RTC in local TZ: no\n      DST active: n\/a\n<\/code><\/pre>\n<p><strong>reboot<\/strong><br \/>\n\u91cd\u542f\u7cfb\u7edf<\/p>\n<p><strong>poweroff<\/strong><br \/>\n\u5173\u673a<\/p>\n<p><strong>wget [\u53c2\u6570] \u7f51\u5740<\/strong><br \/>\n\u7528\u4e8e\u4ece\u7f51\u7edc\u4e2d\u4e0b\u8f7d\u6587\u4ef6<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-b<\/td>\n<td>\u540e\u53f0\u4e0b\u8f7d\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>-P<\/td>\n<td>\u4e0b\u8f7d\u5230\u6307\u5b9a\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>-t<\/td>\n<td>\u6700\u5927\u5c1d\u8bd5\u6b21\u6570<\/td>\n<\/tr>\n<tr>\n<td>-c<\/td>\n<td>\u65ad\u70b9\u7eed\u4f20<\/td>\n<\/tr>\n<tr>\n<td>-p<\/td>\n<td>\u4e0b\u8f7d\u9875\u9762\u5185\u6240\u6709\u8d44\u6e90\u5305\u62ec\u56fe\u7247\u3001\u89c6\u9891<\/td>\n<\/tr>\n<tr>\n<td>-r<\/td>\n<td>\u9012\u5f52\u4e0b\u8f7d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>ps [\u53c2\u6570]<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u7cfb\u7edf\u4e2d\u7684\u8fdb\u7a0b\u72b6\u6001\uff0c\u82f1\u6587\u5168\u79f0\u201cprocesses\u201d<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-a<\/td>\n<td>\u663e\u793a\u6240\u6709\u8fdb\u7a0b\uff08\u5305\u62ec\u5176\u4ed6\u7528\u6237\u7684\uff09<\/td>\n<\/tr>\n<tr>\n<td>-u<\/td>\n<td>\u7528\u6237\u4ee5\u53ca\u5176\u4ed6\u8be6\u7ec6\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>-x<\/td>\n<td>\u663e\u793a\u6ca1\u6709\u63a7\u5236\u7ec8\u7aef\u7684\u8fdb\u7a0b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Linux\u7cfb\u7edf\u4e2d\u6709\u7740\u8bb8\u591a\u8fdb\u7a0b\uff0c\u5b83\u4eec\u67095\u79cd\u5e38\u89c1\u8fdb\u7a0b\u72b6\u6001<\/p>\n<table>\n<thead>\n<tr>\n<th>\u72b6\u6001<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>R\uff08\u8fd0\u884c\uff09<\/td>\n<td>\u8fdb\u7a0b\u6b63\u5728\u8fd0\u884c\u6216\u518d\u961f\u5217\u4e2d\u7b49\u5f85<\/td>\n<\/tr>\n<tr>\n<td>S\uff08\u4e2d\u65ad\uff09<\/td>\n<td>\u8fdb\u7a0b\u5904\u4e8e\u4f11\u7720\u4e2d\uff0c\u5f53\u67d0\u4e2a\u6761\u4ef6\u5f62\u6210\u540e\u6216\u63a5\u6536\u5230\u4fe1\u53f7\u65f6\u5219\u8131\u79bb\u8be5\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td>D\uff08\u4e0d\u53ef\u4e2d\u65ad\uff09<\/td>\n<td>\u8fdb\u7a0b\u4e0d\u54cd\u5e94\u7cfb\u7edf\u5f02\u6b65\u4fe1\u53f7\uff0c\u5373\u4f7fkill\u547d\u4ee4\u4e5f\u4e0d\u80fd\u5c06\u5176\u4e2d\u65ad<\/td>\n<\/tr>\n<tr>\n<td>Z\uff08\u50f5\u6b7b\uff09<\/td>\n<td>\u8fdb\u7a0b\u5df2\u7ec8\u6b62\uff0c\u4f46\u8fdb\u7a0b\u63cf\u8ff0\u7b26\u4f9d\u7136\u5b58\u5728\uff0c\u76f4\u5230\u7236\u8fdb\u7a0b\u8c03\u7528wait4()\u7cfb\u7edf\u51fd\u6570\u540e\u5c06\u8fdb\u7a0b\u91ca\u653e<\/td>\n<\/tr>\n<tr>\n<td>T\uff08\u505c\u6b62\uff09<\/td>\n<td>\u8fdb\u7a0b\u6536\u5230\u505c\u6b62\u4fe1\u53f7\u540e\u505c\u6b62\u8fd0\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u9664\u4e86\u4e0a\u97625\u79cd\u5e38\u89c1\u7684\u8fdb\u7a0b\u72b6\u6001\uff0c\u8fd8\u6709\u53ef\u80fd\u76845\u79cd\u8865\u5145\u5f62\u5f0f\uff1a\u9ad8\u4f18\u5148\u7ea7\uff08&lt;\uff09\u3001\u4f4e\u4f18\u5148\u7ea7\uff08N\uff09\u3001\u88ab\u9501\u8fdb\u5185\u5b58\uff08L\uff09\u3001\u5305\u542b\u5b50\u8fdb\u7a0b\uff08s\uff09\u3001\u591a\u7ebf\u7a0b\uff08l\uff09<\/p>\n<p>\u5f53\u6267\u884c <code>ps -aux<\/code>\u547d\u4ee4\u540e\uff0c\u901a\u5e38\u4f1a\u6709\u4ee5\u4e0b\u8f93\u51fa\u503c<\/p>\n<table>\n<thead>\n<tr>\n<th>USER<\/th>\n<th>PID<\/th>\n<th>%CPU<\/th>\n<th>%MEM<\/th>\n<th>VSZ<\/th>\n<th>RSS<\/th>\n<th>TTY<\/th>\n<th>STAT<\/th>\n<th>START<\/th>\n<th>TIME<\/th>\n<th>COMMAND<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u8fdb\u7a0b\u7684\u6240\u6709\u8005<\/td>\n<td>\u8fdb\u7a0bID\u53f7<\/td>\n<td>cpu\u5360\u7528\u7387<\/td>\n<td>\u5185\u5b58\u5360\u7528\u7387<\/td>\n<td>\u865a\u62df\u5185\u5b58\u4f7f\u7528\u91cfKB<\/td>\n<td>\u5360\u7528\u7684\u56fa\u5b9a\u5185\u5b58\u91cfKB<\/td>\n<td>\u6240\u5728\u7ec8\u7aef<\/td>\n<td>\u8fdb\u7a0b\u72b6\u6001<\/td>\n<td>\u88ab\u542f\u52a8\u7684\u65f6\u95f4<\/td>\n<td>\u5b9e\u9645\u4f7f\u7528cpu\u7684\u65f6\u95f4<\/td>\n<td>\u547d\u4ee4\u540d\u79f0\u4e0e\u53c2\u6570<\/td>\n<\/tr>\n<tr>\n<td>root<\/td>\n<td>1<\/td>\n<td>0.0<\/td>\n<td>0.2<\/td>\n<td>125508<\/td>\n<td>3772<\/td>\n<td>?<\/td>\n<td>Ss<\/td>\n<td>May15<\/td>\n<td>5:28<\/td>\n<td>\/usr\/lib\/system<\/td>\n<\/tr>\n<tr>\n<td>root<\/td>\n<td>2<\/td>\n<td>0.0<\/td>\n<td>0.0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>?<\/td>\n<td>S<\/td>\n<td>May15<\/td>\n<td>0:00<\/td>\n<td>[kthreadd]<\/td>\n<\/tr>\n<tr>\n<td>root<\/td>\n<td>4<\/td>\n<td>0.0<\/td>\n<td>0.0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>?<\/td>\n<td>S&lt;<\/td>\n<td>May15<\/td>\n<td>0:00<\/td>\n<td>[kworker\/0:0H]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>pstree<\/strong><br \/>\n\u4ee5\u6811\u72b6\u56fe\u5f62\u5f0f\u663e\u793a\u8fdb\u7a0b\u4e4b\u95f4\u7684\u5173\u7cfb<\/p>\n<p><strong>top<\/strong><br \/>\n\u7528\u4e8e\u52a8\u6001\u7684\u76d1\u89c6\u8fdb\u7a0b\u6d3b\u52a8\u4ee5\u53ca\u7cfb\u7edf\u8d1f\u8f7d\u4fe1\u606f\uff0c\u7c7b\u4f3cwindow\u4efb\u52a1\u7ba1\u7406\u5668<\/p>\n<pre><code>[root@VM-4-13-centos jan]# top\ntop - 14:40:15 up 25 days, 23:30,  1 user,  load average: 0.00, 0.01, 0.05\nTasks:  87 total,   2 running,  85 sleeping,   0 stopped,   0 zombie\n%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\nKiB Mem :  1881840 total,   757460 free,   228152 used,   896228 buff\/cache\nKiB Swap:        0 total,        0 free,        0 used.  1481148 avail Mem\n\n  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND\n   27 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 md\n   28 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 edac-poller\n...<\/code><\/pre>\n<blockquote>\n<p>\u7b2c1\u884c\uff1a\u7cfb\u7edf\u65f6\u95f4\u3001\u8fd0\u884c\u65f6\u95f4\u3001\u767b\u5f55\u7ec8\u7aef\u6570\u3001\u7cfb\u7edf\u8d1f\u8f7d\uff083\u4e2a\u6570\u503c\u5206\u522b\u4e3a1\u5206\u949f\u30015\u5206\u949f\u300115\u5206\u949f\u5185\u7684\u5e73\u5747\u503c\uff0c\u6570\u503c\u8d8a\u5c0f\u610f\u5473\u7740\u8d1f\u8f7d\u8d8a\u4f4e\uff09\u3002<\/p>\n<p>\u7b2c2\u884c\uff1a\u8fdb\u7a0b\u603b\u6570\u3001\u8fd0\u884c\u4e2d\u7684\u8fdb\u7a0b\u6570\u3001\u7761\u7720\u4e2d\u7684\u8fdb\u7a0b\u6570\u3001\u505c\u6b62\u7684\u8fdb\u7a0b\u6570\u3001\u50f5\u6b7b\u7684\u8fdb\u7a0b\u6570\u3002<\/p>\n<p>\u7b2c3\u884c\uff1a\u7528\u6237\u5360\u7528\u8d44\u6e90\u767e\u5206\u6bd4\u3001\u7cfb\u7edf\u5185\u6838\u5360\u7528\u8d44\u6e90\u767e\u5206\u6bd4\u3001\u6539\u53d8\u8fc7\u4f18\u5148\u7ea7\u7684\u8fdb\u7a0b\u8d44\u6e90\u767e\u5206\u6bd4\u3001\u7a7a\u95f2\u7684\u8d44\u6e90\u767e\u5206\u6bd4\u7b49\u3002\u5176\u4e2d\u6570\u636e\u5747\u4e3aCPU\u6570\u636e\u5e76\u4ee5\u767e\u5206\u6bd4\u683c\u5f0f\u663e\u793a\uff0c\u4f8b\u5982\u201c99.9 id\u201d\u610f\u5473\u7740\u670999.9%\u7684CPU\u5904\u7406\u5668\u8d44\u6e90\u5904\u4e8e\u7a7a\u95f2\u3002<\/p>\n<p>\u7b2c4\u884c\uff1a\u7269\u7406\u5185\u5b58\u603b\u91cf\u3001\u5185\u5b58\u7a7a\u95f2\u91cf\u3001\u5185\u5b58\u4f7f\u7528\u91cf\u3001\u4f5c\u4e3a\u5185\u6838\u7f13\u5b58\u7684\u5185\u5b58\u91cf\u3002<\/p>\n<p>\u7b2c5\u884c\uff1a\u865a\u62df\u5185\u5b58\u603b\u91cf\u3001\u865a\u62df\u5185\u5b58\u7a7a\u95f2\u91cf\u3001\u865a\u62df\u5185\u5b58\u4f7f\u7528\u91cf\u3001\u5df2\u88ab\u63d0\u524d\u52a0\u8f7d\u7684\u5185\u5b58\u91cf\u3002<\/p>\n<\/blockquote>\n<p><strong>nice [\u4f18\u5148\u7ea7\u6570\u5b57] [\u670d\u52a1\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u8c03\u6574\u8fdb\u7a0b\u7684\u4f18\u5148\u7ea7<br \/>\n\u5728top\u547d\u4ee4\u8f93\u51fa\u7684\u7ed3\u679c\u4e2d\uff0cPR\u548cNI\u4ee3\u8868\u7684\u662f\u8fdb\u7a0b\u7684\u4f18\u5148\u7ea7\uff0c\u6570\u5b57\u8d8a\u4f4e\uff0c\u4f18\u5148\u7ea7\u8d8a\u9ad8\uff0c\u4f8b\u5982\u8bb2bash\u7684\u670d\u52a1\u4f18\u5148\u7ea7\u8c03\u81f3\u6700\u9ad8<\/p>\n<pre><code>[root@VM-4-13-centos jan]# nice -n -20 bash<\/code><\/pre>\n<p><strong>pidof [\u53c2\u6570] \u670d\u52a1\u540d\u79f0<\/strong><br \/>\n\u7528\u4e8e\u67e5\u8be2\u67d0\u4e2a\u6307\u5b9a\u670d\u52a1\u8fdb\u7a0b\u7684PID<\/p>\n<pre><code>[root@VM-4-13-centos jan]# pidof sshd\n18629 1057<\/code><\/pre>\n<p><strong>kill [\u53c2\u6570] \u8fdb\u7a0bPID<\/strong><br \/>\n\u7528\u4e8e\u7ec8\u6b62\u6307\u5b9aPID\u7684\u670d\u52a1\u8fdb\u7a0b<\/p>\n<pre><code>[root@VM-4-13-centos jan]# kill 18629<\/code><\/pre>\n<p>\u5982\u679c\u6709\u65f6\u7cfb\u7edf\u63d0\u793a\u8fdb\u7a0b\u65e0\u6cd5\u88ab\u7ec8\u6b62\uff0c\u6b64\u65f6\u53ef\u4ee5\u52a0\u53c2\u6570 -9 \u8868\u793a\u6700\u9ad8\u7ea7\u522b\u5730\u5f3a\u5236\u6740\u6b7b\u8fdb\u7a0b<\/p>\n<pre><code>[root@VM-4-13-centos jan]# kill -9 18629<\/code><\/pre>\n<p><strong>killall [\u53c2\u6570] \u670d\u52a1\u540d\u79f0<\/strong><br \/>\n\u7528\u4e8e\u7ec8\u6b62\u67d0\u4e2a\u6307\u5b9a\u540d\u79f0\u5730\u670d\u52a1\u6240\u5bf9\u5e94\u7684\u5168\u90e8\u8fdb\u7a0b<\/p>\n<pre><code>[root@VM-4-13-centos jan]# pidof httpd\n13581 13580 13579 13578 13577 13576\n[root@VM-4-13-centos jan]# killall httpd\n[root@VM-4-13-centos jan]# pidof httpd\n[root@VM-4-13-centos jan]#<\/code><\/pre>\n<p><strong>ifconfig [\u53c2\u6570] [\u7f51\u7edc\u8bbe\u5907]<\/strong><br \/>\n\u7528\u4e8e\u83b7\u53d6\u7f51\u5361\u914d\u7f6e\u4e0e\u7f51\u7edc\u72b6\u6001\u7b49\u4fe1\u606f\uff0c\u82f1\u6587\u5168\u79f0\u201cinterface config\u201d<\/p>\n<pre><code>[root@VM-4-13-centos jan]# ifconfig\neth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500\n        inet 10.0.4.13  netmask 255.255.252.0  broadcast 10.0.7.255\n        inet6 fe80::5054:ff:fe32:2f7a  prefixlen 64  scopeid 0x20&lt;link&gt;\n        ether 52:54:00:32:2f:7a  txqueuelen 1000  (Ethernet)\n        RX packets 23500110  bytes 3944482374 (3.6 GiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 52720153  bytes 6761279874 (6.2 GiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n\nlo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536\n        inet 127.0.0.1  netmask 255.0.0.0\n        inet6 ::1  prefixlen 128  scopeid 0x10&lt;host&gt;\n        loop  txqueuelen 1000  (Local Loopback)\n        RX packets 2767000  bytes 170296940 (162.4 MiB)\n        RX errors 0  dropped 0  overruns 0  frame 0\n        TX packets 2767000  bytes 170296940 (162.4 MiB)\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\n<\/code><\/pre>\n<p><strong>uname [-a]<\/strong><br \/>\n\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u7684\u5185\u6838\u540d\u79f0\u3001\u4e3b\u673a\u540d\u3001\u5185\u6838\u53d1\u884c\u7248\u672c\u3001\u8282\u70b9\u540d\u3001\u538b\u5236\u65f6\u95f4\u3001\u786c\u4ef6\u540d\u79f0\u3001\u786c\u4ef6\u5e73\u53f0\u3001\u5904\u7406\u5668\u7c7b\u578b\u4ee5\u53ca\u64cd\u4f5c\u7cfb\u7edf\u540d\u79f0<\/p>\n<pre><code>[root@VM-4-13-centos jan]# uname -a\nLinux VM-4-13-centos 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 x86_64 x86_64 GNU\/Linux<\/code><\/pre>\n<p>\u5982\u679c\u8981\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u7248\u672c\u7684\u8be6\u7ec6\u4fe1\u606f\u5219\u9700\u8981\u67e5\u770bredhat-release\u6587\u4ef6<\/p>\n<pre><code>[root@VM-4-13-centos jan]# cat \/etc\/redhat-release\nCentOS Linux release 7.6.1810 (Core)<\/code><\/pre>\n<p><strong>uptime<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u7cfb\u7edf\u8d1f\u8f7d,\u5e73\u5747\u8d1f\u8f7d\u503c\u662f\u6700\u8fd11\u5206\u949f\u30015\u5206\u949f\u300115\u5206\u949f\u5185\u7684\u538b\u529b\u60c5\u51b5<\/p>\n<pre><code>[root@VM-4-13-centos jan]# uptime\n 15:12:21 up 26 days, 2 min,  1 user,  load average: 0.02, 0.02, 0.05<\/code><\/pre>\n<p><strong>free [-h]<\/strong><br \/>\n\u7528\u4e8e\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u4e2d\u5185\u5b58\u7684\u4f7f\u7528\u91cf\u4fe1\u606f\uff0c\u5e26\u4e0a\u53c2\u6570-h\u4ee5\u66f4\u4eba\u6027\u5316\u7684\u65b9\u5f0f\u8f93\u51fa\u5f53\u524d\u5185\u5b58\u4f7f\u7528\u91cf\u4fe1\u606f<\/p>\n<pre><code>[root@VM-4-13-centos jan]# free -h\n              total        used        free      shared  buff\/cache   available\nMem:           1.8G        222M        738M        560K        877M        1.4G\nSwap:            0B          0B          0B<\/code><\/pre>\n<p><strong>who<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u5f53\u524d\u767b\u5165\u4e3b\u673a\u7684\u7528\u6237\u7aef\u4fe1\u606f<\/p>\n<p><strong>last<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u4e3b\u673a\u88ab\u8bbf\u95ee\u8bb0\u5f55<\/p>\n<p><strong>ping [\u53c2\u6570] \u4e3b\u673a\u5730\u5740<\/strong><br \/>\n\u7528\u4e8e\u6d4b\u8bd5\u4e3b\u673a\u4e4b\u95f4\u7684\u7f51\u7edc\u8fde\u901a\u6027<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-c<\/td>\n<td>\u53d1\u9001\u6b21\u6570<\/td>\n<\/tr>\n<tr>\n<td>-l<\/td>\n<td>\u6307\u5b9a\u7f51\u5361\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>-i<\/td>\n<td>\u6bcf\u6b21\u95f4\u9694\u65f6\u95f4\u79d2<\/td>\n<\/tr>\n<tr>\n<td>-W<\/td>\n<td>\u6700\u957f\u7b49\u5f85\u65f6\u95f4\u79d2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>tracepath [\u53c2\u6570] \u57df\u540d<\/strong><br \/>\n\u6d4b\u8bd5\u6570\u636e\u5305\u5230\u8fbe\u4e3b\u673a\u65f6\u9014\u4e2d\u7ecf\u8fc7\u7684\u6240\u6709\u8def\u7531\u4fe1\u606f<\/p>\n<pre><code>[root@VM-4-13-centos jan]# tracepath www.loveuhouse.cn\n 1?: [LOCALHOST]                                         pmtu 1500\n 1:  9.112.63.130                                          4.955ms\n 1:  9.112.63.130                                          1.873ms\n 2:  9.112.123.62                                          6.560ms\n 3:  10.196.39.249                                         0.738ms\n 4:  10.196.95.33                                         26.646ms asymm 11\n 5:  103.216.40.40                                        31.500ms asymm  9\n 6:  10.200.43.166                                        23.873ms asymm  9\n 7:  117.49.44.166                                        32.730ms asymm  8\n 8:  103.216.40.40                                        30.296ms asymm  9\n 9:  45.112.216.157                                       34.218ms\n10:  45.112.221.186                                       32.006ms asymm  8\n11:  119.38.215.29                                        27.570ms asymm  9\n12:  no reply\n13:  no reply\n14:  no reply\n...<\/code><\/pre>\n<p><strong>netstat [\u53c2\u6570]<\/strong><br \/>\n\u7528\u4e8e\u663e\u793a\u7f51\u7edc\u94fe\u63a5\u3001\u8def\u7531\u8868\u3001\u63a5\u53e3\u72b6\u6001\u7b49\u5b8c\u4e86\u8fc7\u4fe1\u606f\uff0c\u82f1\u6587\u5168\u79f0\u4e3a\u201cnetwork status\u201d<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-a<\/td>\n<td>\u663e\u793a\u6240\u6709\u94fe\u63a5\u4e2d\u7684Socket<\/td>\n<\/tr>\n<tr>\n<td>-p<\/td>\n<td>\u663e\u793a\u6b63\u5728\u4f7f\u7528\u7684Socket<\/td>\n<\/tr>\n<tr>\n<td>-t<\/td>\n<td>\u663e\u793aTCP\u534f\u8bae\u7684\u94fe\u63a5\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td>-u<\/td>\n<td>\u663e\u793aUDP\u534f\u8bae\u7684\u94fe\u63a5\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td>-n<\/td>\n<td>\u4f7f\u7528IP\u5730\u5740\uff0c\u4e0d\u4f7f\u7528\u57df\u540d<\/td>\n<\/tr>\n<tr>\n<td>-l<\/td>\n<td>\u4ec5\u5217\u51fa\u6b63\u5728\u76d1\u542c\u7684\u670d\u52a1\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td>-i<\/td>\n<td>\u663e\u793a\u7f51\u5361\u5217\u8868\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>-r<\/td>\n<td>\u663e\u793a\u8def\u7531\u8868\u4fe1\u606f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>history [-c]<\/strong><br \/>\n\u7528\u4e8e\u663e\u793a\u6267\u884c\u8fc7\u7684\u547d\u4ee4\u5386\u53f2, \u53c2\u6570-c\u53ef\u4ee5\u6e05\u7a7a\u6240\u6709\u7684\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55<br \/>\n\u8fd8\u80fd\u7528\u201c!\u7f16\u7801\u6570\u5b57\u201d\u6765\u91cd\u590d\u6267\u884c\u67d0\u4e00\u6b21\u7684\u547d\u4ee4<\/p>\n<pre><code>[root@VM-4-13-centos jan]# history\n    1  2022-06-10 13:43:48\n    2  2022-05-15 15:10:02 ls\n[root@VM-4-13-centos jan]# !2\nls<\/code><\/pre>\n<p>\u5386\u53f2\u547d\u4ee4\u4f1a\u88ab\u4fdd\u5b58\u5230\u7528\u6237home\u76ee\u5f55\u7684.bash_history\u6587\u4ef6\u4e2d\uff0cLinux\u7cfb\u7edf\u4e2d\u4ee5(.)\u5f00\u5934\u7684\u6587\u4ef6\u5747\u6807\u8bc6\u9690\u85cf\u6587\u4ef6<\/p>\n<pre><code>[root@VM-4-13-centos jan]# cat ~\/.bash_history\n\n#1652598602\nls\n#1652598628\nwget https:\/\/img.zeruns.tech\/down\/jdk-8u261-linux-x64.tar.gz\n#1652598653\nmkdir \/usr\/local\/java\/\n...<\/code><\/pre>\n<p><strong>sosreport<\/strong><br \/>\n\u7528\u4e8e\u624b\u673a\u7cfb\u7edf\u914d\u7f6e\u53ca\u67b6\u6784\u4fe1\u606f\u5e76\u8f93\u51fa\u8bca\u65ad\u6587\u6863\uff0c\u5e38\u7528\u4e8e\u8bca\u65ad\u7cfb\u7edf\u95ee\u9898<\/p>\n<p><strong>pwd<\/strong><br \/>\n\u7528\u4e8e\u663e\u793a\u7528\u6237\u5f53\u524d\u6240\u5728\u5de5\u4f5c\u76ee\u5f55\uff0c\u82f1\u6587\u5168\u79f0\u4e3a\u201cprint working directory\u201d<\/p>\n<pre><code>[root@VM-4-13-centos jan]# pwd\n\/root\/jan<\/code><\/pre>\n<p><strong>cd [\u53c2\u6570] [\u76ee\u5f55]<\/strong><br \/>\n\u7528\u4e8e\u5207\u6362\u5f53\u524d\u5de5\u4f5c\u8def\u5f84\uff0c\u82f1\u6587\u5168\u79f0\u201cchange directory\u201d<br \/>\n\u9664\u4e86\u5e38\u89c1\u7684\u5207\u6362\u76ee\u5f55\u65b9\u5f0f\uff0c\u8fd8\u80fd\u7528<br \/>\n<code>cd -<\/code>\u8fd4\u56de\u4e0a\u4e00\u6b21\u6240\u5904\u7684\u76ee\u5f55<br \/>\n<code>cd ..<\/code>\u8fdb\u5165\u4e0a\u7ea7\u76ee\u5f55<br \/>\n<code>cd ~<\/code>\u5207\u6362\u5230home\u76ee\u5f55<br \/>\n<code>cd ~ username<\/code>\u5207\u6362\u5230\u5176\u4ed6\u7528\u6237\u7684home\u76ee\u5f55<\/p>\n<p><strong>ls [\u53c2\u6570] [\u6587\u4ef6\u540d]<\/strong><br \/>\n\u7528\u4e8e\u663e\u793a\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u4fe1\u606f<\/p>\n<pre><code>[root@VM-4-13-centos jan]# ls -al\ntotal 8\ndrwxr-xr-x   2 root root 4096 Jun 10 10:46 .\ndr-xr-x---. 11 root root 4096 Jun 10 10:46 ..<\/code><\/pre>\n<p>\u5982\u679c\u8981\u67e5\u770b\u76ee\u5f55\uff0c\u9700\u8981\u989d\u5916\u6dfb\u52a0\u4e00\u4e2a-d\u53c2\u6570<\/p>\n<pre><code>[root@VM-4-13-centos jan]# ls -ld \/etc\ndrwxr-xr-x. 94 root root 12288 May 20 13:42 \/etc<\/code><\/pre>\n<p><strong>tree<\/strong><br \/>\n\u7528\u4e8e\u4ee5\u6811\u72b6\u56fe\u7684\u65b9\u5f0f\u5217\u51fa\u76ee\u5f55\u5185\u5bb9\u53ca\u7ed3\u6784<\/p>\n<p><strong>find [\u67e5\u627e\u8303\u56f4] [\u5bfb\u627e\u6761\u4ef6]<\/strong><br \/>\n\u7528\u4e8e\u6309\u7167\u6307\u5b9a\u6761\u4ef6\u6765\u67e5\u627e\u6587\u4ef6\u6240\u5bf9\u5e94\u7684\u4f4d\u7f6e<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-name<\/td>\n<td>\u5339\u914d\u540d\u79f0<\/td>\n<\/tr>\n<tr>\n<td>-perm<\/td>\n<td>\u5339\u914d\u6743\u9650\uff08mode\u5b8c\u5168\u5339\u914d\uff0c -mode\u4e3a\u5305\u542b\uff09<\/td>\n<\/tr>\n<tr>\n<td>-usr<\/td>\n<td>\u5339\u914d\u6240\u6709\u8005<\/td>\n<\/tr>\n<tr>\n<td>-group<\/td>\n<td>\u5339\u914d\u6240\u6709\u7ec4<\/td>\n<\/tr>\n<tr>\n<td>-mtime -n +n<\/td>\n<td>\u5339\u914d\u4fee\u6539\u5185\u5bb9\u7684\u65f6\u95f4\uff08-n\u6307n\u5929\u4ee5\u5185 +n\u6307n\u5929\u4ee5\u524d\uff09<\/td>\n<\/tr>\n<tr>\n<td>-atime -n +n<\/td>\n<td>\u5339\u914d\u8bbf\u95ee\u6587\u4ef6\u7684\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>-ctime -n +n<\/td>\n<td>\u5339\u914d\u4fee\u6539\u6587\u4ef6\u6743\u9650\u7684\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>-nouser<\/td>\n<td>\u5339\u914d\u65e0\u6240\u6709\u8005\u7684\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>-nogroup<\/td>\n<td>\u5339\u914d\u65e0\u6240\u6709\u7ec4\u7684\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>-newer f1 !f2<\/td>\n<td>\u5339\u914d\u6bd4f1\u65b0\u4f46\u6bd4f2\u65e7\u7684\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>-type b\/d\/c\/p\/l\/f<\/td>\n<td>\u5339\u914d\u6587\u4ef6\u7c7b\u578b\uff08\u5757\u8bbe\u5907\u3001\u76ee\u5f55\u3001\u5b57\u7b26\u8bbe\u5907\u3001\u7ba1\u9053\u3001\u94fe\u63a5\u6587\u4ef6\u3001\u6587\u672c\u6587\u4ef6\uff09<\/td>\n<\/tr>\n<tr>\n<td>-size<\/td>\n<td>\u5339\u914d\u6587\u4ef6\u5927\u5c0f\uff08+50KB\u6307\u67e5\u627e\u8d85\u8fc7\u7684\u6587\u4ef6\uff0c -50KB\u6307\u67e5\u627e\u5c0f\u4e8e\u7684\u6587\u4ef6\uff09<\/td>\n<\/tr>\n<tr>\n<td>-prune<\/td>\n<td>\u5ffd\u7565\u67d0\u4e2a\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>-exec<\/td>\n<td>\u540e\u9762\u53ef\u8ddf\u7528\u4e8e\u8fdb\u4e00\u6b65\u5904\u7406\u641c\u7d22\u7ed3\u679c\u7684\u547d\u4ee4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6839\u636e\u6587\u4ef6\u7cfb\u7edf\u5c42\u6b21\u6807\u51c6\uff08Filesystem Hierarchy Standard\uff09\u534f\u8bae\uff0cLinux\u7cfb\u7edf\u4e2d\u7684\u914d\u7f6e\u6587\u4ef6\u4f1a\u4fdd\u5b58\u5230\/etc\u76ee\u5f55\u4e2d\uff0c\u5982\u679c\u60f3\u8981\u83b7\u53d6\u8be5\u76ee\u5f55\u4e2d\u6240\u6709host\u5f00\u5934\u7684\u6587\u4ef6\u5217\u8868<\/p>\n<pre><code>[root@VM-4-13-centos jan]# find \/etc -name &quot;host*&quot; -print\n\/etc\/hosts.deny\n\/etc\/hostname\n\/etc\/cloud\/templates\/hosts.suse.tmpl\n\/etc\/cloud\/templates\/hosts.debian.tmpl\n\/etc\/cloud\/templates\/hosts.redhat.tmpl\n\/etc\/cloud\/templates\/hosts.freebsd.tmpl\n\/etc\/hosts\n\/etc\/selinux\/targeted\/active\/modules\/100\/hostname\n\/etc\/hosts.allow\n\/etc\/host.conf<\/code><\/pre>\n<p>\u5982\u679c\u60f3\u8981\u5728\u6574\u4e2a\u7cfb\u7edf\u641c\u6743\u9650\u4e2d\u5305\u62ecSUID\u6743\u9650\u7684\u6240\u6709\u6587\u4ef6\uff0c\u53ea\u9700\u4f7f\u7528-4000\u5373\u53ef<\/p>\n<pre><code>[root@VM-4-13-centos jan]# find \/ -perm -4000 -print\n\/usr\/lib\/polkit-1\/polkit-agent-helper-1\n\/usr\/bin\/pkexec\n\/usr\/bin\/mount\n\/usr\/bin\/passwd\n\/usr\/bin\/umount\n\/usr\/bin\/newgrp<\/code><\/pre>\n<p>\u5982\u679c\u8981\u5728\u6574\u4e2a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u627e\u5230\u6240\u6709\u5f52\u5c5e\u4e8ejaning\u7528\u6237\u7684\u6587\u4ef6\u5e76\u590d\u5236\u5230\/root\/findresults\u76ee\u5f55\u4e2d,\u5c06\u8981\u4f7f\u7528<code>-exec {} \\<\/code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d<code>{}<\/code>\u4ee3\u8868find\u547d\u4ee4\u641c\u7d22\u51fa\u7684\u6bcf\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u4e14\u547d\u4ee4\u7684\u7ed3\u5c3e\u5fc5\u987b\u662f<code>\\<\/code><\/p>\n<pre><code>find \/ -usr janing -exec cp -a {} \/root\/findresults\/ \\<\/code><\/pre>\n<p><strong>locate [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u6309\u7167\u540d\u79f0\u5feb\u901f\u641c\u7d22\u6587\u4ef6\u6240\u5bf9\u5e94\u7684\u4f4d\u7f6e\uff0c\u5728\u4f7f\u7528<code>locate<\/code>\u547d\u4ee4\u65f6\uff0c\u5148\u4f7f\u7528<code>updatedb<\/code>\u547d\u4ee4\u751f\u6210\u4e00\u4e2a\u7d22\u5f15\u5e93\u6587\u4ef6\uff0c\u8fd9\u4e2a\u5e93\u6587\u4ef6\u7684\u540d\u5b57\u662f<code>\/var\/lib\/mlocate\/mlocate.db<\/code>\u540e\u7eed\u5728\u4f7f\u7528locate\u547d\u4ee4\u641c\u7d22\u6587\u4ef6\u65f6\u5c31\u662f\u5728\u8be5\u5e93\u4e2d\u8fdb\u884c\u67e5\u627e\u64cd\u4f5c<\/p>\n<pre><code>[root@VM-4-13-centos jan]# updatedb\n[root@VM-4-13-centos jan]# ls -l \/var\/lib\/mlocate\/mlocate.db\n-rw-r----- 1 root slocate 2521187 Jun 10 16:16 \/var\/lib\/mlocate\/mlocate.db\n[root@VM-4-13-centos jan]# locate whereis\n\/usr\/bin\/whereis\n\/usr\/share\/bash-completion\/completions\/whereis\n\/usr\/share\/man\/man1\/whereis.1.gz<\/code><\/pre>\n<p><strong>whereis [\u547d\u4ee4\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u6309\u7167\u540d\u79f0\u5feb\u901f\u641c\u7d22\u4e8c\u8fdb\u5236\u7a0b\u5e8f\uff08\u547d\u4ee4\uff09\u3001\u6e90\u7801\u3001\u4ee5\u53ca\u5e2e\u52a9\u6587\u4ef6\u6240\u5bf9\u5e94\u7684\u4f4d\u7f6e<br \/>\n\u7b80\u5355\u6765\u8bf4<code>whereis<\/code>\u4e5f\u662f\u57fa\u4e8e<code>updatedb<\/code>\u6240\u751f\u6210\u7684\u7d22\u5f15\u5e93\u8fdb\u884c\u641c\u7d22\uff0c\u5b83\u4e0elocate\u547d\u4ee4\u7684\u533a\u522b\u65f6\u4e0d\u5173\u5fc3\u90a3\u4e9b\u76f8\u540c\u540d\u79f0\u7684\u6587\u4ef6\uff0c\u4ec5\u4ec5\u662f\u5feb\u901f\u627e\u5230\u5bf9\u5e94\u7684\u547d\u4ee4\u4e3a\u4f60\u6559\u6848\u4ee5\u53ca\u5e2e\u52a9\u6587\u4ef6<\/p>\n<pre><code>[root@VM-4-13-centos jan]# whereis node\nnode: \/usr\/bin\/node<\/code><\/pre>\n<p><strong>which [\u547d\u4ee4\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u6309\u7167\u6307\u5b9a\u540d\u79f0\u5feb\u901f\u641c\u7d22\u4e8c\u8fdb\u5236\u7a0b\u5e8f\uff08\u547d\u4ee4\uff09\u6240\u5bf9\u5e94\u7684\u4f4d\u7f6e\uff0c<code>which<\/code>\u547d\u4ee4\u662f\u5728PATH\u53d8\u91cf\u6240\u6307\u5b9a\u7684\u8def\u5f84\u4e2d\u67e5\u627e\uff0c\u65e2\u4e0d\u5173\u5fc3\u540c\u540d\u6587\u4ef6\u4e5f\u4e0d\u5173\u5fc3\u547d\u4ee4\u6240\u5bf9\u5e94\u7684\u6e90\u4ee3\u7801\u548c\u5e2e\u52a9\u6587\u4ef6<\/p>\n<pre><code>[root@VM-4-13-centos jan]# which node\n\/usr\/bin\/node<\/code><\/pre>\n<p><strong>cat [\u53c2\u6570] \u6587\u4ef6\u540d\u79f0<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u5185\u5bb9\u8f83\u5c11\u7684\u7eaf\u6587\u672c\u6587\u4ef6\uff0c\u82f1\u6587\u5168\u79f0\u4e3a\u201cconcatenate\u201d\uff0c\u5982\u679c\u60f3\u8981\u663e\u793a\u884c\u53f7\uff0c\u53ef\u4ee5\u589e\u52a0<code>-n<\/code>\u53c2\u6570<\/p>\n<pre><code>[root@VM-4-13-centos jan]# cat -n \/etc\/redhat-release\n     1  CentOS Linux release 7.6.1810 (Core)<\/code><\/pre>\n<p><strong>more [\u53c2\u6570] \u6587\u4ef6\u540d\u79f0<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u5185\u5bb9\u8f83\u591a\u7684\u7eaf\u6587\u672c\u6587\u4ef6\uff0c\u4f7f\u7528\u7a7a\u683c\u6216\u56de\u8f66\u5411\u4e0b\u7ffb\u9875<\/p>\n<p><strong>head [\u53c2\u6570] \u6587\u4ef6\u540d\u79f0<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u7eaf\u6587\u672c\u6587\u4ef6\u7684\u524d\u51e0\u884c<\/p>\n<pre><code>[root@VM-4-13-centos jan]# head -n 5 \/usr\/share\/autoconf\/autom4te.cfg\n# Definition of Autom4te option sets.                     -*- Makefile -*-\n#\n# Copyright (C) 2001-2012 Free Software Foundation, Inc.\n#\n# This program is free software: you can redistribute it and\/or modify<\/code><\/pre>\n<p><strong>tail [\u53c2\u6570] \u6587\u4ef6\u540d\u79f0<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u7eaf\u6587\u672c\u6587\u4ef6\u7684\u540en\u884c\u6216\u6301\u7eed\u5237\u65b0\u6587\u4ef6\u7684\u6700\u65b0\u5185\u5bb9<br \/>\n\u5f53\u4f60\u5411\u67e5\u770b\u6301\u7eed\u5237\u65b0\u7684\u6587\u4ef6\u5185\u5bb9\u53ef\u4ee5\u4f7f\u7528<code>-f<\/code>\u53c2\u6570<\/p>\n<pre><code>[root@VM-4-13-centos jan]# tail -f \/var\/log\/message<\/code><\/pre>\n<p><strong>tr [\u539f\u59cb\u5b57\u7b26] [\u76ee\u6807\u5b57\u7b26]<\/strong><br \/>\n\u7528\u4e8e\u66ff\u6362\u6587\u672c\u5185\u5bb9\u4e2d\u7684\u5b57\u7b26\uff0c\u82f1\u6587\u5168\u79f0\u4e3a\u201ctransform\u201d<br \/>\n\u6bd4\u5982\u8981\u628a\u6587\u672c\u5168\u90e8\u6539\u4e3a\u5927\u5199<\/p>\n<pre><code>[root@VM-4-13-centos jan]# cat hello.txt\nhello world\n[root@VM-4-13-centos jan]# cat hello.txt | tr [a-z] [A-Z]\nHELLO WORLD<\/code><\/pre>\n<p><strong>wc [\u53c2\u6570] [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u7edf\u8ba1\u6307\u5b9a\u6587\u672c\u6587\u4ef6\u7684\u884c\u6570\u3001\u5b57\u6570\u6216\u5b57\u8282\u6570\uff0c\u82f1\u6587\u5168\u79f0\u201cword counts\u201d<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-l<\/td>\n<td>\u53ea\u663e\u793a\u884c\u6570<\/td>\n<\/tr>\n<tr>\n<td>-w<\/td>\n<td>\u53ea\u663e\u793a\u5355\u8bcd\u6570<\/td>\n<\/tr>\n<tr>\n<td>-c<\/td>\n<td>\u53ea\u663e\u793a\u5b57\u8282\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d<code>\/etc\/passwd<\/code>\u662f\u7528\u4e8e\u4fdd\u5b58\u6240\u6709\u7528\u6237\u4fe1\u606f\u7684\u6587\u4ef6\uff0c\u8981\u7edf\u8ba1\u5f53\u524d\u7cfb\u7edf\u6709\u591a\u5c11\u4e2a\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u67e5\u8be2<\/p>\n<pre><code>[root@VM-4-13-centos jan]# wc -l \/etc\/passwd\n26 \/etc\/passwd<\/code><\/pre>\n<p><strong>stat [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u67e5\u770b\u6587\u4ef6\u7684\u5177\u4f53\u50a8\u5b58\u7ec6\u8282\u548c\u65f6\u95f4\u7b49\u4fe1\u606f<\/p>\n<pre><code>[root@VM-4-13-centos jan]# stat hello.txt\n  File: \u2018hello.txt\u2019\n  Size: 12              Blocks: 8          IO Block: 4096   regular file\nDevice: fd01h\/64769d    Inode: 665210      Links: 1\nAccess: (0644\/-rw-r--r--)  Uid: (    0\/    root)   Gid: (    0\/    root)\nAccess: 2022-06-10 16:35:14.426104440 +0800\nModify: 2022-06-10 16:35:14.385104450 +0800\nChange: 2022-06-10 16:35:14.385104450 +0800\n Birth: -<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th><strong>grep [\u53c2\u6570] [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u63d0\u53d6\u6587\u672c\u5185\u5bb9\uff0c\u4ee5\u4e0b\u53c2\u6570\u6700\u4e3a\u5e38\u7528<\/th>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-n<\/td>\n<td>\u7528\u6765\u663e\u793a\u641c\u7d22\u5230\u7684\u4fe1\u606f\u7684\u884c\u53f7<\/td>\n<\/tr>\n<tr>\n<td>-v<\/td>\n<td>\u7528\u6765\u53cd\u9009\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>-b<\/td>\n<td>\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u5f53\u4f5c\u6587\u672c\u6587\u4ef6\u6765\u641c\u7d22<\/td>\n<\/tr>\n<tr>\n<td>-c<\/td>\n<td>\u4ec5\u663e\u793a\u627e\u5230\u7684\u884c\u6570<\/td>\n<\/tr>\n<tr>\n<td>-i<\/td>\n<td>\u5ffd\u7565\u5927\u5c0f\u5199<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Linux\u7cfb\u7edf\u4e2d<code>\/etc\/passwd<\/code>\u4fdd\u5b58\u6240\u6709\u7684\u7528\u6237\u4fe1\u606f\uff0c\u800c\u4e00\u65e6\u7528\u6237\u767b\u5f55\u7ec8\u7aef\u88ab\u8bbe\u7f6e\u6210<code>\/sbin\/nologin<\/code>\u5219\u4e0d\u518d\u5141\u8bb8\u767b\u5f55\u7cfb\u7edf\uff0c\u56e0\u6b64\u53ef\u4ee5\u67e5\u627e\u5f53\u524d\u7cfb\u7edf\u4e2d\u4e0d\u5141\u8bb8\u767b\u5f55\u7cfb\u7edf\u7684\u7528\u6237<\/p>\n<pre><code>[root@VM-4-13-centos ~]# grep \/sbin\/nologin \/etc\/passwd\nbin:x:1:1:bin:\/bin:\/sbin\/nologin\ndaemon:x:2:2:daemon:\/sbin:\/sbin\/nologin\nadm:x:3:4:adm:\/var\/adm:\/sbin\/nologin\n...<\/code><\/pre>\n<p><strong>cut [\u53c2\u6570] [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u6309\u5217\u63d0\u53d6\u6587\u672c\u5185\u5bb9<br \/>\n\u6bd4\u5982\u63d0\u53d6passwd\u6587\u4ef6\u4e2d\u7684\u7528\u6237\u540d\u4fe1\u606f<code>-f<\/code>\u8bbe\u7f6e\u9700\u8981\u67e5\u770b\u7684\u5217\u6570<code>-d<\/code>\u8bbe\u7f6e\u5206\u5272\u7b26<\/p>\n<pre><code>[root@VM-4-13-centos ~]# cut -d : -f 1 \/etc\/passwd\nroot\nbin\ndaemon<\/code><\/pre>\n<p><strong>diff [\u53c2\u6570] [\u6587\u4ef6A] [\u6587\u4ef6B]<\/strong><br \/>\n\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u4e4b\u95f4\u5185\u5bb9\u7684\u5dee\u5f02\uff0c\u53ef\u4ee5\u4f7f\u7528<code>--brief<\/code>\u53c2\u6570\u6765\u786e\u8ba4\u4e24\u4e2a\u6587\u4ef6\u662f\u5426\u76f8\u540c\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>-c<\/code>\u6765\u8be6\u7ec6\u6bd4\u8f83\u591a\u4e2a\u6587\u4ef6\u7684\u5dee\u5f02\u4e4b\u5904<\/p>\n<pre><code>[root@VM-4-13-centos jan]# diff hello.txt hello2.txt\n1c1\n&lt; hello world\n---\n> hello world 2<\/code><\/pre>\n<p><strong>uniq [\u53c2\u6570] [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u53bb\u9664\u6587\u672c\u4e2d\u8fde\u7eed\u7684\u91cd\u590d\u884c<\/p>\n<pre><code>[root@VM-4-13-centos jan]# uniq hello.txt<\/code><\/pre>\n<p><strong>sort [\u53c2\u6570] [\u6587\u4ef6\u540d\u79f0]<\/strong><br \/>\n\u5bf9\u6587\u672c\u5185\u5bb9\u518d\u6392\u5e8f\uff0c\u8fd8\u80fd\u4f7f\u7528<code>-u<\/code>\u53c2\u6570\u8fdb\u884c\u53bb\u91cd\uff0c<code>-t<\/code>\u6307\u5b9a\u95f4\u9694\u7b26\uff0c<code>-k<\/code>\u6307\u5b9a\u7b2c\u51e0\u5217\uff0c<code>-n<\/code>\u6570\u5b57\u6392\u5e8f<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-f<\/td>\n<td>\u5ffd\u7565\u5927\u5c0f\u5199<\/td>\n<\/tr>\n<tr>\n<td>-b<\/td>\n<td>\u5ffd\u7565\u7f29\u8fdb\u4e0e\u7a7a\u683c<\/td>\n<\/tr>\n<tr>\n<td>-n<\/td>\n<td>\u4ee5\u6570\u503c\u578b\u6392\u5e8f<\/td>\n<\/tr>\n<tr>\n<td>-r<\/td>\n<td>\u53cd\u5411\u6392\u5e8f<\/td>\n<\/tr>\n<tr>\n<td>-u<\/td>\n<td>\u53bb\u9664\u91cd\u590d\u884c<\/td>\n<\/tr>\n<tr>\n<td>-t<\/td>\n<td>\u6307\u5b9a\u95f4\u9694\u7b26<\/td>\n<\/tr>\n<tr>\n<td>-k<\/td>\n<td>\u8bbe\u7f6e\u5b57\u6bb5\u8303\u56f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>touch [\u53c2\u6570] [\u6587\u4ef6\u540d]<\/strong><br \/>\n\u7528\u4e8e\u521b\u5efa\u7a7a\u767d\u6587\u4ef6\u6216\u8bbe\u7f6e\u6587\u4ef6\u65f6\u95f4\uff0c<code>touch abc<\/code>\u53ef\u4ee5\u5feb\u901f\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aabc\u7684\u7a7a\u767d\u6587\u672c\u6587\u4ef6<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-a<\/td>\n<td>\u4ec5\u4fee\u6539\u8bfb\u53d6\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>-m<\/td>\n<td>\u4ec5\u4fee\u6539\u4fee\u6539\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>-d<\/td>\n<td>\u540c\u65f6\u4fee\u6539atime\u4e0emtime<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>mkdir [\u53c2\u6570] [\u76ee\u5f55\u540d\u79f0]<\/strong><br \/>\n\u7528\u4e8e\u521b\u5efa\u7a7a\u767d\u76ee\u5f55\uff0c\u53ef\u4ee5\u7ed3\u5408<code>-p<\/code>\u6765\u9012\u5f52\u521b\u5efa\u51fa\u5177\u6709\u5d4c\u5957\u5c42\u53e0\u5173\u7cfb\u7684\u76ee\u5f55<\/p>\n<pre><code>[root@VM-4-13-centos jan]# mkdir -p a\/b\/c\/d\/e<\/code><\/pre>\n<p><strong>cp [\u53c2\u6570] [\u6e90\u6587\u4ef6] [\u76ee\u6807\u6587\u4ef6]<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\uff1a \u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b man [\u6307\u4ee4] \u5e2e\u52a9\u6587\u6863 \u6309\u952e \u4f5c\u7528 \u7a7a\u683c\u952e \u5411\u4e0b\u7ffb\u9875 Page down &hellip; <a href=\"https:\/\/loveuhouse.cn\/wordpress\/?p=800\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u5e38\u7528linux\u6307\u4ee4<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40,1],"tags":[],"_links":{"self":[{"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/800"}],"collection":[{"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=800"}],"version-history":[{"count":4,"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/800\/revisions"}],"predecessor-version":[{"id":804,"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/800\/revisions\/804"}],"wp:attachment":[{"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loveuhouse.cn\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}