{"id":362,"date":"2026-04-26T22:16:31","date_gmt":"2026-04-26T14:16:31","guid":{"rendered":"http:\/\/www.millscience.cn\/?p=362"},"modified":"2026-04-26T22:16:32","modified_gmt":"2026-04-26T14:16:32","slug":"linuxcommand","status":"publish","type":"post","link":"https:\/\/www.millscience.cn\/index.php\/linuxcommand\/","title":{"rendered":"\u5e38\u89c1linux\u6307\u4ee4"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Linux\u547d\u4ee4\u884c\u975e\u5e38\u5f3a\u5927\uff0c\u5e38\u7528\u6307\u4ee4\u6309\u529f\u80fd\u53ef\u5206\u4e3a\u4ee5\u4e0b\u51e0\u7c7b\uff0c\u4e0b\u9762\u9010\u4e00\u8bf4\u660e\u6838\u5fc3\u547d\u4ee4\u53ca\u5176\u5178\u578b\u7528\u6cd5\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e00\u3001\u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>ls<\/code><\/td><td>\u5217\u51fa\u76ee\u5f55\u5185\u5bb9<\/td><td><code>ls -la<\/code>\uff08\u663e\u793a\u6240\u6709\u6587\u4ef6\uff0c\u542b\u9690\u85cf\u6587\u4ef6\u53ca\u8be6\u60c5\uff09<\/td><\/tr><tr><td><code>cd<\/code><\/td><td>\u5207\u6362\u76ee\u5f55<\/td><td><code>cd \/home\/user<\/code> \u6216 <code>cd ..<\/code>\uff08\u4e0a\u7ea7\u76ee\u5f55\uff09<\/td><\/tr><tr><td><code>pwd<\/code><\/td><td>\u663e\u793a\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u7684\u7edd\u5bf9\u8def\u5f84<\/td><td><\/td><\/tr><tr><td><code>mkdir<\/code><\/td><td>\u521b\u5efa\u65b0\u76ee\u5f55<\/td><td><code>mkdir new_folder<\/code><\/td><\/tr><tr><td><code>rmdir<\/code><\/td><td>\u5220\u9664\u7a7a\u76ee\u5f55<\/td><td><\/td><\/tr><tr><td><code>rm<\/code><\/td><td>\u5220\u9664\u6587\u4ef6\u6216\u76ee\u5f55<\/td><td><code>rm -rf dir\/<\/code>\uff08\u5f3a\u5236\u9012\u5f52\u5220\u9664\uff0c\u614e\u7528\uff09<\/td><\/tr><tr><td><code>cp<\/code><\/td><td>\u590d\u5236\u6587\u4ef6\u6216\u76ee\u5f55<\/td><td><code>cp source.txt dest.txt<\/code>\uff1b<code>cp -r source_dir\/ dest_dir\/<\/code><\/td><\/tr><tr><td><code>mv<\/code><\/td><td>\u79fb\u52a8\u6216\u91cd\u547d\u540d\u6587\u4ef6<\/td><td><code>mv oldname.txt newname.txt<\/code><\/td><\/tr><tr><td><code>touch<\/code><\/td><td>\u521b\u5efa\u7a7a\u6587\u4ef6\u6216\u66f4\u65b0\u6587\u4ef6\u65f6\u95f4\u6233<\/td><td><code>touch file.txt<\/code><\/td><\/tr><tr><td><code>cat<\/code><\/td><td>\u67e5\u770b\u5b8c\u6574\u6587\u4ef6\u5185\u5bb9<\/td><td><code>cat file.txt<\/code><\/td><\/tr><tr><td><code>less<\/code> \/ <code>more<\/code><\/td><td>\u5206\u9875\u67e5\u770b\u5927\u6587\u4ef6<\/td><td><code>less longfile.log<\/code>\uff08\u6309q\u9000\u51fa\uff09<\/td><\/tr><tr><td><code>head<\/code> \/ <code>tail<\/code><\/td><td>\u67e5\u770b\u6587\u4ef6\u5934\/\u5c3e\u82e5\u5e72\u884c<\/td><td><code>tail -f log.txt<\/code>\uff08\u5b9e\u65f6\u8ffd\u8e2a\u65e5\u5fd7\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e8c\u3001\u6587\u672c\u5904\u7406\u4e0e\u641c\u7d22<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>grep<\/code><\/td><td>\u641c\u7d22\u6587\u672c\u5185\u5bb9\uff08\u652f\u6301\u6b63\u5219\uff09<\/td><td><code>grep \"error\" app.log<\/code><\/td><\/tr><tr><td><code>find<\/code><\/td><td>\u6309\u6761\u4ef6\u67e5\u627e\u6587\u4ef6<\/td><td><code>find \/home -name \"*.conf\"<\/code><\/td><\/tr><tr><td><code>sed<\/code><\/td><td>\u6d41\u7f16\u8f91\u5668\uff0c\u66ff\u6362\/\u5220\u9664\u6587\u672c<\/td><td><code>sed 's\/old\/new\/g' file.txt<\/code><\/td><\/tr><tr><td><code>awk<\/code><\/td><td>\u7ed3\u6784\u5316\u6587\u672c\u5904\u7406\uff08\u5217\u64cd\u4f5c\uff09<\/td><td><code>awk '{print $1}' data.txt<\/code><\/td><\/tr><tr><td><code>sort<\/code><\/td><td>\u6392\u5e8f<\/td><td><code>sort -n numbers.txt<\/code><\/td><\/tr><tr><td><code>uniq<\/code><\/td><td>\u53bb\u91cd\uff08\u901a\u5e38\u4e0esort\u8fde\u7528\uff09<\/td><td><code>sort list.txt | uniq -c<\/code><\/td><\/tr><tr><td><code>wc<\/code><\/td><td>\u7edf\u8ba1\u884c\u3001\u5355\u8bcd\u3001\u5b57\u7b26\u6570<\/td><td><code>wc -l file.txt<\/code>\uff08\u4ec5\u884c\u6570\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e09\u3001\u6743\u9650\u4e0e\u7528\u6237\u7ba1\u7406<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>chmod<\/code><\/td><td>\u4fee\u6539\u6587\u4ef6\u6743\u9650<\/td><td><code>chmod 755 script.sh<\/code> \u6216 <code>chmod u+x script.sh<\/code><\/td><\/tr><tr><td><code>chown<\/code><\/td><td>\u4fee\u6539\u6587\u4ef6\u6240\u6709\u8005\u53ca\u7ec4<\/td><td><code>chown user:group file.txt<\/code><\/td><\/tr><tr><td><code>useradd<\/code> \/ <code>userdel<\/code><\/td><td>\u6dfb\u52a0\/\u5220\u9664\u7528\u6237<\/td><td><code>useradd -m newuser<\/code><\/td><\/tr><tr><td><code>passwd<\/code><\/td><td>\u4fee\u6539\u7528\u6237\u5bc6\u7801<\/td><td><\/td><\/tr><tr><td><code>whoami<\/code><\/td><td>\u663e\u793a\u5f53\u524d\u7528\u6237\u540d<\/td><td><\/td><\/tr><tr><td><code>sudo<\/code><\/td><td>\u4ee5\u8d85\u7ea7\u7528\u6237\u6743\u9650\u6267\u884c\u547d\u4ee4<\/td><td><code>sudo apt update<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u56db\u3001\u8fdb\u7a0b\u4e0e\u7cfb\u7edf\u4fe1\u606f<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>ps<\/code><\/td><td>\u67e5\u770b\u8fdb\u7a0b\u5feb\u7167<\/td><td><code>ps aux<\/code> \u6216 <code>ps -ef<\/code><\/td><\/tr><tr><td><code>top<\/code> \/ <code>htop<\/code><\/td><td>\u52a8\u6001\u5b9e\u65f6\u67e5\u770b\u7cfb\u7edf\u8d1f\u8f7d\u548c\u8fdb\u7a0b<\/td><td>\u6309<code>q<\/code>\u9000\u51fa<\/td><\/tr><tr><td><code>kill<\/code><\/td><td>\u7ec8\u6b62\u8fdb\u7a0b\uff08\u901a\u8fc7PID\uff09<\/td><td><code>kill -9 1234<\/code>\uff08\u5f3a\u5236\u6740\u6b7b\uff09<\/td><\/tr><tr><td><code>jobs<\/code><\/td><td>\u67e5\u770b\u540e\u53f0\u4efb\u52a1<\/td><td><\/td><\/tr><tr><td><code>fg<\/code> \/ <code>bg<\/code><\/td><td>\u5c06\u4efb\u52a1\u5207\u6362\u5230\u524d\u53f0\/\u540e\u53f0<\/td><td><\/td><\/tr><tr><td><code>df<\/code><\/td><td>\u67e5\u770b\u78c1\u76d8\u5206\u533a\u4f7f\u7528\u60c5\u51b5<\/td><td><code>df -h<\/code>\uff08\u4eba\u7c7b\u6613\u8bfb\u683c\u5f0f\uff09<\/td><\/tr><tr><td><code>du<\/code><\/td><td>\u67e5\u770b\u76ee\u5f55\u6216\u6587\u4ef6\u5360\u7528\u7a7a\u95f4<\/td><td><code>du -sh dir\/<\/code><\/td><\/tr><tr><td><code>free<\/code><\/td><td>\u67e5\u770b\u5185\u5b58\u4f7f\u7528<\/td><td><code>free -h<\/code><\/td><\/tr><tr><td><code>uname<\/code><\/td><td>\u67e5\u770b\u7cfb\u7edf\u5185\u6838\u4fe1\u606f<\/td><td><code>uname -a<\/code><\/td><\/tr><tr><td><code>uptime<\/code><\/td><td>\u67e5\u770b\u7cfb\u7edf\u8fd0\u884c\u65f6\u95f4\u548c\u5e73\u5747\u8d1f\u8f7d<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e94\u3001\u7f51\u7edc\u76f8\u5173<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>ping<\/code><\/td><td>\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027<\/td><td><code>ping google.com<\/code><\/td><\/tr><tr><td><code>ifconfig<\/code> \/ <code>ip<\/code><\/td><td>\u67e5\u770b\/\u914d\u7f6e\u7f51\u7edc\u63a5\u53e3<\/td><td><code>ip addr<\/code><\/td><\/tr><tr><td><code>netstat<\/code><\/td><td>\u663e\u793a\u7f51\u7edc\u8fde\u63a5\u3001\u8def\u7531\u8868\u7b49<\/td><td><code>netstat -tuln<\/code>\uff08\u76d1\u542c\u7aef\u53e3\uff09<\/td><\/tr><tr><td><code>ss<\/code><\/td><td>\u66ff\u4ee3netstat\uff0c\u66f4\u5feb\u66f4\u73b0\u4ee3<\/td><td><code>ss -tuln<\/code><\/td><\/tr><tr><td><code>curl<\/code><\/td><td>\u53d1\u9001HTTP\u8bf7\u6c42\u6216\u4e0b\u8f7d\u6587\u4ef6<\/td><td><code>curl -O https:\/\/example.com\/file.zip<\/code><\/td><\/tr><tr><td><code>wget<\/code><\/td><td>\u4e0b\u8f7d\u6587\u4ef6\uff08\u652f\u6301\u65ad\u70b9\u7eed\u4f20\uff09<\/td><td><code>wget -c http:\/\/...<\/code><\/td><\/tr><tr><td><code>ssh<\/code><\/td><td>\u8fdc\u7a0b\u767b\u5f55\u5230\u53e6\u4e00\u53f0\u673a\u5668<\/td><td><code>ssh user@host<\/code><\/td><\/tr><tr><td><code>scp<\/code><\/td><td>\u57fa\u4e8eSSH\u7684\u8fdc\u7a0b\u6587\u4ef6\u590d\u5236<\/td><td><code>scp local.txt user@remote:\/path\/<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u516d\u3001\u538b\u7f29\u4e0e\u6253\u5305<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>tar<\/code><\/td><td>\u6253\u5305\/\u89e3\u5305\uff08\u5e38\u4e0e\u538b\u7f29\u7ed3\u5408\uff09<\/td><td><code>tar -czf archive.tar.gz dir\/<\/code>\uff08\u6253\u5305\u5e76gzip\u538b\u7f29\uff09<br><code>tar -xzf archive.tar.gz<\/code>\uff08\u89e3\u538b\uff09<\/td><\/tr><tr><td><code>gzip<\/code> \/ <code>gunzip<\/code><\/td><td>\u5355\u6587\u4ef6\u538b\u7f29\/\u89e3\u538b<\/td><td><\/td><\/tr><tr><td><code>zip<\/code> \/ <code>unzip<\/code><\/td><td>zip\u683c\u5f0f\u538b\u7f29\/\u89e3\u538b<\/td><td><code>unzip file.zip<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e03\u3001\u5e2e\u52a9\u4e0e\u6587\u6863<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u547d\u4ee4<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>man<\/code><\/td><td>\u67e5\u770b\u547d\u4ee4\u7684\u8be6\u7ec6\u624b\u518c<\/td><td><code>man ls<\/code><\/td><\/tr><tr><td><code>--help<\/code><\/td><td>\u5927\u591a\u6570\u547d\u4ee4\u652f\u6301\u6b64\u53c2\u6570\u663e\u793a\u7b80\u8981\u5e2e\u52a9<\/td><td><code>ls --help<\/code><\/td><\/tr><tr><td><code>info<\/code><\/td><td>\u66f4\u8be6\u7ec6\u7684\u6587\u6863\uff08\u6bd4man\u66f4\u7ed3\u6784\u5316\uff09<\/td><td><code>info tar<\/code><\/td><\/tr><tr><td><code>whatis<\/code><\/td><td>\u663e\u793a\u547d\u4ee4\u7684\u4e00\u884c\u63cf\u8ff0<\/td><td><code>whatis ls<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u547d\u4ee4\u884c\u975e\u5e38\u5f3a\u5927\uff0c\u5e38\u7528\u6307\u4ee4\u6309\u529f\u80fd\u53ef\u5206\u4e3a\u4ee5\u4e0b\u51e0\u7c7b\uff0c\u4e0b\u9762\u9010\u4e00\u8bf4\u660e\u6838\u5fc3\u547d\u4ee4\u53ca\u5176\u5178\u578b\u7528\u6cd5\u3002 \u4e00\u3001\u6587\u4ef6\u4e0e\u76ee\u5f55\u64cd\u4f5c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":363,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,13],"tags":[],"class_list":["post-362","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntulearning","category-learning"],"_links":{"self":[{"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/posts\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/comments?post=362"}],"version-history":[{"count":1,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/posts\/362\/revisions"}],"predecessor-version":[{"id":364,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/posts\/362\/revisions\/364"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/media\/363"}],"wp:attachment":[{"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/media?parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/categories?post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.millscience.cn\/index.php\/wp-json\/wp\/v2\/tags?post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}