{"id":8385,"date":"2024-04-25T13:01:01","date_gmt":"2024-04-25T05:01:01","guid":{"rendered":""},"modified":"2024-04-25T13:01:01","modified_gmt":"2024-04-25T05:01:01","slug":"\u6211\u7684Linux\u5b66\u4e60\u4e4b\u65c5","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8385.html","title":{"rendered":"\u6211\u7684Linux\u5b66\u4e60\u4e4b\u65c5"},"content":{"rendered":"
\u4e00\u4e2a\u591a\u6708\u7684\u65f6\u95f4\u5b66\u4e60Linux\u7684\u57fa\u7840\u77e5\u8bc6\uff0c\u770b\u5f97\u662f\u9e1f\u54e5\u7684\u79c1\u623f\u83dc\uff0c\u770b\u4e86\u6709\u4e24\u904d\u5427\u3002\u73b0\u5728\u603b\u7ed3\u4e00\u4e0b\u5e73\u65f6\u7ecf\u5e38\u7528\u5230\u7684\u77e5\u8bc6\u3002<\/span><\/p>\n date\uff1a<\/span><\/p>\n \u663e\u793a\u65f6\u95f4\uff0c\u66f4\u591a\u7684\u662f\u7528\u6765\u4ea7\u751f\u4e00\u4e9b\u65f6\u95f4\u683c\u5f0f\u7684\u6587\u4ef6\u5939\uff0c\u5982\uff1a\u751f\u6210\u65e5\u5fd7\u7684\u6587\u4ef6\u5939\u3002<\/span><\/p>\n bc\uff1a<\/span><\/p>\n \u8ba1\u7b97\u5668\uff0cquit\u9000\u51fa\uff0c\u4e00\u822c\u7528\u4e0d\u5230\u3002<\/span><\/p>\n ctrl+alt+F1\uff5eF6\u53ef\u5207\u6362\u4e0d\u540c\u7684\u6587\u5b57\u754c\u9762\uff0c\u4e00\u822c\u7528\u4e8e\uff1a\u5982\u679c\u4e00\u4e2a\u754c\u9762\u6b7b\u6389\u4e86\uff0c\u53ef\u4ee5\u518d\u5207\u6362\u53e6\u4e00\u4e2a\u754c\u9762\u5c06\u5176\u6740\u6b7b\uff0c\u800c\u4e0d\u7528\u91cd\u542f\u8ba1\u7b97\u673a\uff0c\u5f88\u65b9\u4fbf\u7684\u3002ctrl+alt+F7\u5207\u6362\u5230\u6587\u5b57\u754c\u9762\u3002<\/span><\/p>\n \u5f53\u6307\u4ee4\u592a\u957f\u65f6\u53ef\u7528'\\'\u7b26\u53f7\u6765\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002<\/span><\/p>\n shutdown -r now \u7acb\u523b\u91cd\u542f<\/span><\/p>\n shutdown -h now \u7acb\u523b\u5173\u673a<\/span><\/p>\n shutdown -h +10 \u201cguan ji le \u201d \u5341\u5206\u949f\u540e\u5173\u673a\uff0c\u5e76\u5728\u5c4f\u5e55\u4e0a\u663e\u793aguan ji le<\/span><\/p>\n shutdown -h 20:35 \u5230\u70b9\u5173\u673a shutdown -c \u53d6\u6d88\u5df2\u7ecf\u8fdb\u884c\u7684shutdown\u6307\u4ee4<\/span><\/p>\n ll ** \u67e5\u770b**\u7684\u5c5e\u6027<\/span><\/p>\n w\uff1a\u5199 \uff1br\uff1a\u8bfb\uff1bx\uff1a\u53ef\u6267\u884c\uff08\u53ea\u6709\u5f53\u6587\u4ef6\u5939\u662f\u53ef\u6267\u884c\u65f6\u624d\u80fd\u591f\u8fdb\u5165\u8be5\u6587\u4ef6\u5939\uff09<\/span><\/p>\n r=4<\/span><\/p>\n w=2<\/span><\/p>\n x=1 \u4e00\u4e2a\u6587\u4ef6\u7684\u6743\u9650\u9488\u5bf9\u201c\u4e09\u4e2a\u4eba\u201d\u800c\u8a00\uff1a\u6587\u4ef6\u62e5\u6709\u8005\u7684\u6743\u9650(u)\u3001\u6587\u4ef6\u6240\u5c5e\u7684\u7fa4\u7ec4\u4e2d\u4ed6\u4eba\u7684\u6743\u9650(g)\u3001\u5916\u4eba\u7684\u6743\u9650(o)\u3002<\/span><\/p>\n chgrp aa user \u628a\u5f53\u524duser\u7684\u7fa4\u7ec4\u7684\u540d\u79f0\u6539\u4e3a\u4e86aa<\/span><\/p>\n chown bb user \u628a\u5f53\u524duser\u7684\u62e5\u6709\u8005\u7684\u540d\u79f0\u6539\u4e3a\u4e86bb<\/span><\/p>\n chown aa:bb user \u628a\u5f53\u524duser\u7684\u7fa4\u7ec4\u7684\u540d\u79f0\u6539\u4e3a\u4e86aa\uff0c\u62e5\u6709\u8005\u7684\u540d\u79f0\u6539\u4e3a\u4e86bb<\/span><\/p>\n chmod 777 file \u6539\u53d8\u4e86file\u7684\u6743\u9650\u4e3a\u53ef\u8bfb\u3001\u53ef\u5199\u3001\u53ef\u6267\u884c chmod -R 777 mulu \u6539\u53d8mulu\u6587\u4ef6\u5939\u4e0b\u9762\u6240\u6709\u6587\u4ef6\u7684\u6743\u9650\uff08chgrp\u3001chown\u4e5f\u53ef\u4ee5\u6709-R)<\/span><\/p>\n chmod r=rwx,g=rwx,o=rwx temp chmod a+w temp chmod a-x temp<\/span><\/p>\n \u5f53\u4e00\u4e2a\u8bbe\u7f6e\u4e86SUID\u4f4d\u7684\u53ef\u6267\u884c\u6587\u4ef6\u88ab\u6267\u884c\u65f6\uff0c\u8be5\u6587\u4ef6\u5c06\u4ee5\u6240\u6709\u8005\u7684\u8eab\u4efd\u8fd0\u884c\uff0c\u4e0e\u5c31\u662f\u8bf4\u65e0\u8bba\u8c01\u6765\u6267\u884c\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4ed6\u90fd\u6709\u6587\u4ef6\u6240\u6709\u8005\u7684\u7279\u6743\uff0c\u5982\u679c\u6240\u6709\u8005\u7684\u8eab\u4efd\u662froot\u7684\u8bdd\uff0c\u90a3\u4e48\u6267\u884c\u4eba\u5c31\u6709\u8d85\u7ea7\u7528\u6237\u7684\u8eab\u4efd\u3002 SUID=4,SGID=2 chmod 4777 a.txt \u6743\u9650\u53d8\u4e3a rwsrwsrwx<\/span><\/p>\n chmod 6751 a.txt \u6743\u9650\u53d8\u4e3a rwsrwS--x \uff08\u5f53\u8bbe\u7f6e\u4e86x\u4f4d\u65f6\uff0c\u5c31\u7528\u5c0fs\uff1b\u6ca1\u6709\u8bbe\u7f6ex\u4f4d\u65f6\uff0c\u5c31\u7528\u5927S\uff09 \u8def\u5f84\uff1acd - \u56de\u5230\u4e0a\u4e00\u76ee\u5f55(\u5f88\u597d\u7528)<\/span><\/p>\n cd .. \u56de\u5230\u4e0a\u4e00\u5c42\u76ee\u5f55<\/span><\/p>\n cd \uff5e\u56de\u5230\u7528\u6237\u6839\u76ee\u5f55<\/span><\/p>\n pwd \u663e\u793a\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55<\/span><\/p>\n mkdir aa \u5efa\u7acb\u4e00\u4e2a\u540d\u79f0\u4e3aaa\u7684\u6587\u4ef6\u5939<\/span><\/p>\n \u5220\u9664\u4e00\u5207\u4e1c\u897f\u7528\uff1a rm -rf bb \u5f3a\u5236\u5220\u9664\uff08\u8d85\u597d\u7528\uff09<\/span><\/p>\n ls \u5217\u51fa\u5f53\u524d\u76ee\u5f55\u4e0b\u7684\u4e1c\u897f<\/span><\/p>\n ls -a \u9690\u85cf\u7684\u4e1c\u4e1c\u4e5f\u4f1a\u5217\u51fa<\/span><\/p>\n ll \u5217\u51fa\u5c5e\u6027<\/span><\/p>\n cp \u590d\u5236\u6587\u4ef6<\/span><\/p>\n cp -r \u590d\u5236\u76ee\u5f55<\/span><\/p>\n cp -u \u53ea\u5728\u6587\u4ef6\u6709\u6240\u6539\u53d8\u540e\u624d\u4f1a\u8fdb\u884c\u590d\u5236\u3002\uff08\u7528\u4e8e\u5907\u4efd\u6587\u4ef6\uff0c\u53ea\u6709\u5728\u4e0d\u540c\u65f6\uff0c\u624d\u4f1a\u8fdb\u884c\u5907\u4efd)<\/span><\/p>\n scp \u4e3a\u8fdc\u7a0b\u590d\u5236<\/span><\/p>\n scp \/home\/aa.txt root@10.52.210.10:\/home \u4f20\u51fa\u6587\u4ef6<\/span><\/p>\n scp root@10.52.210.10:\/home\/bb.txt \/home \u4f20\u5165\u6587\u4ef6 mv \u79fb\u52a8\u6587\u4ef6<\/span><\/p>\n mv -r \u79fb\u52a8\u76ee\u5f55<\/span><\/p>\n mv -u \u53ea\u5728\u6587\u4ef6\u6709\u6240\u6539\u53d8\u540e\u624d\u4f1a\u8fdb\u884c\u79fb\u52a8\u3002<\/span><\/p>\n \u67e5\u770b\u6587\u4ef6\uff1a<\/span><\/p>\n cat aa.txt cat -n \u663e\u793a\u884c\u53f7<\/span><\/p>\n more less<\/span><\/p>\n head -n 10 aa \u53ea\u663e\u793aaa\u6587\u4ef6\u7684\u524d\u5341\u884c<\/span><\/p>\n tail -n 10 aa \u53ea\u663e\u793aaa\u6587\u4ef6\u7684\u540e\u5341\u884c<\/span><\/p>\n tail -f aa \u52a8\u6001\u663e\u793aaa\u540e\u5341\u884c\uff08\u7ecf\u5e38\u7528\uff09<\/span><\/p>\n nl \u663e\u793a\u884c\u53f7<\/span><\/p>\n ln -s aa bb \u7c7b\u4f3c\u4e0ebb\u4e3aaa\u7684\u5feb\u6377\u65b9\u5f0f\uff08\u7b26\u53f7\u94fe\u63a5\u6539\u53d8bb\uff0c\u90a3\u4e48aa\u4e5f\u4f1a\u6539\u53d8\u3002\u5220\u9664aa\uff0c\u90a3\u4e48bb\u5219\u65e0\u6548\uff09<\/span><\/p>\n umask \u7528\u4e8e\u6307\u5b9a\u5f53\u524d\u7528\u6237\u6240\u5efa\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u9ed8\u8ba4\u5c5e\u6027<\/span><\/p>\n umask 0000 \u8868\u793a\u6539\u53d8\u5176\u9ed8\u8ba4\u5c5e\u6027\u4e3a777\u201c\u4e09\u4e2a\u4eba\u201d\u90fd\u662f\u53ef\u8bfb\u3001\u53ef\u5199\u3001\u53ef\u6267\u884c\uff08\u4f46\u662f\u4e0b\u6b21\u5f00\u673a\u540e\u5c31\u56de\u590d\u539f\u6765\u9ed8\u8ba4\u7684\uff09<\/span><\/p>\n \uff08\u82e5\u60f3\u6c38\u8fdc\u7684\u6539\u53d8umask\u7684\u503c\uff0c\u5e94\u5728\/root\/.bashrc\u6587\u4ef6\u4e2d\u52a0\u5165 umask 0000 \u7136\u540e\u4fdd\u5b58\uff0c\u518d\u6267\u884c. .bashrc \u5373\u53ef\uff09<\/span><\/p>\n \u6587\u4ef6\u6216\u76ee\u5f55\u7684\u67e5\u627e<\/span><\/p>\n which<\/span><\/p>\n whereis<\/span><\/p>\n locate<\/span><\/p>\n find<\/span><\/p>\n \u786c\u76d8\u4e0e\u786c\u4ef6\u7ba1\u7406<\/span><\/p>\n df -h \u67e5\u770b\u786c\u76d8\u7684\u603b\u5bb9\u91cf\u3001\u5df2\u7528\u5bb9\u91cf\u3001\u7cfb\u7edf\u5206\u533a<\/span><\/p>\n ifconfig \u67e5\u770bip<\/span><\/p>\n ifconfig eth0 192.168.120.23 netmask 255.255.255.255 broadcast 8.8.8.8 \u914d\u7f6eIP\u5730\u5740 du -sh \u76ee\u5f55\u540d \u53ea\u663e\u793a\u8be5\u76ee\u5f55\u603b\u7684\u5927\u5c0f<\/span><\/p>\n wc -l \u7edf\u8ba1\u884c\u6570<\/span><\/p>\n wc -c \u7edf\u8ba1\u5b57\u8282\u6570<\/span><\/p>\n wc -w \u7edf\u8ba1\u5b57\u6570<\/span><\/p>\n ssh root@10.52.210.10 \u767b\u5f55\u8fdc\u7a0b\u8ba1\u7b97\u673a<\/span><\/p>\n md5sum \u4ea7\u751f\u6587\u4ef6\u6307\u7eb9\uff0c\u53ef\u4ee5\u5bf9\u6bd4\u4e24\u4e2a\u6587\u4ef6\u662f\u5426\u76f8\u540c\u3002\u4e5f\u53ef\u4ee5\u67e5\u770b\u67d0\u4e00\u8f6f\u4ef6\u662f\u5426\u4e3a\u6b63\u7248<\/span><\/p>\n tab \u8865\u5168<\/span><\/p>\n alias ll=\u2018ls -a -l\u2019 \u547d\u540d\u522b\u540d<\/span><\/p>\n echo $? \u53ef\u4ee5\u5224\u65ad\u4e0a\u4e00\u6761\u6307\u4ee4\u662f\u5426\u6b63\u786e\uff0c\u4e3a0\uff0c\u5219\u6b63\u786e\u3002\u4e3a1\uff0c\u5219\u6709\u9519\u8bef<\/span><\/p>\n shell\u811a\u672c<\/span><\/p>\n \u53d8\u91cf\u7684\u89c4\u5219\uff1a<\/span><\/p>\n 1)=\u94fe\u63a5\u7684\u5de6\u53f3\u4e0d\u80fd\u6709\u7a7a\u683c<\/span><\/p>\n 2)\u53d8\u91cf\u53ea\u80fd\u4e3a\u5b57\u6bcd\u3001\u6570\u5b57\uff0c\u5e76\u4ee5\u5b57\u6bcd\u5f00\u5934<\/span><\/p>\n 3)\u5e94\u7528\u53d8\u91cf\u8981\u52a0$ 4)\u82e5\u6709\u7a7a\u683c\u5e94\u7528\u201c \u201d \u6216\u2018 \u2019\u3002\u4e8c\u8005\u7684\u533a\u522b\uff1a\u201c \"\u4f1a\u4fdd\u7559\u53d8\u91cf\u7684\u7279\u6027\uff1b\u800c\u2018 \u2019\u503c\u662f\u8f93\u51fa\u5176\u4e2d\u7684\u5b57\u7b26<\/span><\/p>\n name=vbird<\/span><\/p>\n my=\"$name its me\"<\/span><\/p>\n my2='$name its me'<\/span><\/p>\n my3=\"${name}itsme\" \u548c\u53d8\u91cf\u76f8\u8fde\u8981\u7528{ }\u533a\u5206\u51fa\u6765 echo $my (\u7ed3\u679c\u4e3avbirdits me) echo $my2 (\u7ed3\u679c\u4e3a$name its me)<\/span><\/p>\n echo $my3 (\u7ed3\u679c\u4e3anameitsme) 5)export a \u5219\u53d8\u91cfa\u53ef\u4ee5\u5728\u5176\u4ed6\u5b50\u7a0b\u5e8f\u4e2d\u4f7f\u7528<\/span><\/p>\n 6)unset a \u53d6\u6d88\u53d8\u91cf<\/span><\/p>\n vi\u7f16\u8f91\u5668\u4e2d\u7684\u6307\u4ee4<\/span><\/p>\n \u4e00\u822c\u6a21\u5f0f\u4e0b\uff1a 0 \u96f6 \u5149\u6807\u79fb\u52a8\u5230\u672c\u884c\u7684\u884c\u9996<\/span><\/p>\n $ \u5149\u6807\u79fb\u52a8\u5230\u672c\u884c\u7684\u884c\u5c3e<\/span><\/p>\n G \u5149\u6807\u79fb\u52a8\u5230\u8be5\u6587\u4ef6\u7684\u6700\u540e\u4e00\u884c<\/span><\/p>\n nG \u5149\u6807\u79fb\u52a8\u5230\u7b2cn\u884c gg \u5149\u6807\u79fb\u52a8\u5230\u8be5\u6587\u4ef6\u7684\u7b2c\u4e00\u884c<\/span><\/p>\n n<enter> \u5149\u6807\u5411\u4e0b\u79fb\u52a8n\u884c<\/span><\/p>\n n<\u7a7a\u683c> \u5149\u6807\u5411\u540e\u79fb\u52a8n\u4e2a<\/span><\/p>\n dd \u5220\u9664\u5149\u6807\u6240\u5728\u884c<\/span><\/p>\n yy \u590d\u5236\u5149\u6807\u6240\u5728\u884c<\/span><\/p>\n p \u7c98\u8d34\u5230\u5149\u6807\u7684\u4e0b\u4e00\u884c<\/span><\/p>\n U \u6062\u590d\u4e0a\u4e00\u6b65<\/span><\/p>\n ctrl + r \u4e0eU\u662f\u76f8\u53cd\u7684\u64cd\u4f5c<\/span><\/p>\n . \u91cd\u590d\u524d\u4e00\u4e2a\u64cd\u4f5c \u7f16\u8f91\u6a21\u5f0f\uff1a<\/span><\/p>\n i \u5149\u6807\u6240\u5728\u5b57\u7b26\u524d\u63d2\u5165 a\u5149\u6807\u6240\u5728\u5b57\u7b26\u540e\u63d2\u5165<\/span><\/p>\n o \u5149\u6807\u7684\u4e0b\u4e00\u884c\u63d2\u5165<\/span><\/p>\n \u547d\u4ee4\u884c\u6a21\u5f0f\uff1a<\/span><\/p>\n :set nu \u663e\u793a\u884c\u53f7<\/span><\/p>\n :wq \u4fdd\u5b58\u9000\u51fa :q! \u5f3a\u5236\u9000\u51fa<\/span><\/p>\n \/ab \u5728\u8be5\u6587\u4ef6\u4e2d\u67e5\u627eab \uff08n\u4e3a\u67e5\u627e\u4e0b\u4e00\u4e2a\uff0cN\u4e3a\u67e5\u627e\u4e0a\u4e00\u4e2a\uff09<\/span><\/p>\n \u4e2a\u4eba\u8bbe\u5b9a\uff1a<\/span><\/p>\n \u5728root\u4e2d\uff0c\u6216cd ~\u4e2d\uff0c\u603b\u4e4b\u662f\u5728\u5f53\u524d\u7528\u6237\u7684\u6839\u76ee\u5f55\u4e0b\u4e2d\u7684.bashrc\u6587\u4ef6\u4e2d\u53ef\u4ee5\u8bbe\u5b9a\uff0c\u5982\uff1a\u547d\u540d\u522b\u540d\u3001\u8def\u5f84\u5b9a\u4e49\u3001umask\u7684\u8bbe\u5b9a\uff0c\u4fdd\u5b58\u4e4b\u540e\u8981\u6267\u884csource .bashrc \u624d\u80fd\u751f\u6548\u3002<\/span><\/p>\n ctrl+H \u663e\u793a\u9690\u85cf\u7684\u4e1c\u4e1c<\/span><\/p>\n \u8fde\u7eed\u7684\u6307\u4ee4 && \u548c || command1, command2 \u5168\u90e8\u6267\u884c\u4e24\u6761\u6307\u4ee4 command1 && command2 \u53ea\u6709\u5f53command1\u6267\u884c\u6b63\u786e\u540e\u624d\u6267\u884ccommand2<\/span><\/p>\n command1 || command2 \u53ea\u6709\u5f53command1\u6267\u884c\u9519\u8bef\u540e\u624d\u6267\u884ccommand2<\/span><\/p>\n ctrl + C \u4e2d\u6b62<\/span><\/p>\n<\/p>\n ctrl + D \u7ed3\u675f\u8f93\u5165
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n
<\/span><\/p>\n