{"id":3578,"date":"2019-06-27T16:30:58","date_gmt":"2019-06-27T08:30:58","guid":{"rendered":"https:\/\/damogame.cn\/wordpress\/?p=3578"},"modified":"2019-06-27T16:31:29","modified_gmt":"2019-06-27T08:31:29","slug":"linux%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e5%a4%a7%e5%85%a8%ef%bc%88%e6%9c%80%e5%ae%8c%e6%95%b4%ef%bc%89","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/3578","title":{"rendered":"Linux\u5e38\u7528\u547d\u4ee4\u5927\u5168\uff08\u6700\u5b8c\u6574\uff09"},"content":{"rendered":"<header class=\"Post-Header\">\n<div><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/66677618\">\u539f\u6587\u5730\u5740<\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div>\u7aef\u53e3\u76d1\u542c\u67e5\u770b\uff1a<\/div>\n<\/header>\n<div class=\"Post-RichTextContainer\">\n<div class=\"RichText ztext Post-RichText\">\n<p>ss -tln \u67e5\u770bTCP\u7684listen\u7684\u7aef\u53e3<\/p>\n<p>ss -tlnp \u67e5\u770b\u54ea\u4e9b\u8fdb\u7a0b\u4f7f\u7528\u4e86\u76d1\u542c\u7aef\u53e3<\/p>\n<p>\u9632\u706b\u5899<\/p>\n<p>systemctl status iptables (\u6216service iptables status) \u67e5\u770b\u9632\u706b\u5899\u72b6\u6001<\/p>\n<p>systemctl stop iptables(\u6216service iptables stop) \u5173\u95ed\u9632\u706b\u5899<\/p>\n<p>\u7cfb\u7edf\u4fe1\u606f<\/p>\n<p>curl\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/ifconfig.me\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">ifconfig.me<\/a>\u00a0\u67e5\u627e\u672c\u673a\u516c\u7f51IP<\/p>\n<p>arch \u663e\u793a\u673a\u5668\u7684\u5904\u7406\u5668\u67b6\u6784(1)<\/p>\n<p>uname -m \u663e\u793a\u673a\u5668\u7684\u5904\u7406\u5668\u67b6\u6784(2)<\/p>\n<p>uname -r \u663e\u793a\u6b63\u5728\u4f7f\u7528\u7684\u5185\u6838\u7248\u672c<\/p>\n<p>dmidecode -q \u663e\u793a\u786c\u4ef6\u7cfb\u7edf\u90e8\u4ef6 &#8211; (SMBIOS \/ DMI)<\/p>\n<p>hdparm -i \/dev\/hda \u7f57\u5217\u4e00\u4e2a\u78c1\u76d8\u7684\u67b6\u6784\u7279\u6027<\/p>\n<p>hdparm -tT \/dev\/sda \u5728\u78c1\u76d8\u4e0a\u6267\u884c\u6d4b\u8bd5\u6027\u8bfb\u53d6\u64cd\u4f5c<\/p>\n<p>cat \/proc\/cpuinfo \u663e\u793aCPU info\u7684\u4fe1\u606f<\/p>\n<p>cat \/proc\/interrupts \u663e\u793a\u4e2d\u65ad<\/p>\n<p>cat \/proc\/meminfo \u6821\u9a8c\u5185\u5b58\u4f7f\u7528<\/p>\n<p>cat \/proc\/swaps \u663e\u793a\u54ea\u4e9bswap\u88ab\u4f7f\u7528<\/p>\n<p>cat \/proc\/version \u663e\u793a\u5185\u6838\u7684\u7248\u672c<\/p>\n<p>cat \/proc\/net\/dev \u663e\u793a\u7f51\u7edc\u9002\u914d\u5668\u53ca\u7edf\u8ba1<\/p>\n<p>cat \/proc\/mounts \u663e\u793a\u5df2\u52a0\u8f7d\u7684\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>lspci -tv \u7f57\u5217 PCI \u8bbe\u5907<\/p>\n<p>lsusb -tv \u663e\u793a USB \u8bbe\u5907<\/p>\n<p>date \u663e\u793a\u7cfb\u7edf\u65e5\u671f<\/p>\n<p>cal 2007 \u663e\u793a2007\u5e74\u7684\u65e5\u5386\u8868<\/p>\n<p>date 041217002007.00 \u8bbe\u7f6e\u65e5\u671f\u548c\u65f6\u95f4 &#8211; \u6708\u65e5\u65f6\u5206\u5e74.\u79d2<\/p>\n<p>clock -w \u5c06\u65f6\u95f4\u4fee\u6539\u4fdd\u5b58\u5230 BIOS<\/p>\n<p>ps\u547d\u4ee4\u5e38\u7528\u7528\u6cd5\uff08\u65b9\u4fbf\u67e5\u770b\u7cfb\u7edf\u8fdb\u7a0b\uff09<\/p>\n<p>1\uff09ps a \u663e\u793a\u73b0\u884c\u7ec8\u7aef\u673a\u4e0b\u7684\u6240\u6709\u7a0b\u5e8f\uff0c\u5305\u62ec\u5176\u4ed6\u7528\u6237\u7684\u7a0b\u5e8f\u3002<\/p>\n<p>2\uff09ps -A \u663e\u793a\u6240\u6709\u8fdb\u7a0b\u3002<\/p>\n<p>3\uff09ps c \u5217\u51fa\u7a0b\u5e8f\u65f6\uff0c\u663e\u793a\u6bcf\u4e2a\u7a0b\u5e8f\u771f\u6b63\u7684\u6307\u4ee4\u540d\u79f0\uff0c\u800c\u4e0d\u5305\u542b\u8def\u5f84\uff0c\u53c2\u6570\u6216\u5e38\u9a7b\u670d\u52a1\u7684\u6807\u793a\u3002<\/p>\n<p>4\uff09ps -e \u6b64\u53c2\u6570\u7684\u6548\u679c\u548c\u6307\u5b9a&#8221;A&#8221;\u53c2\u6570\u76f8\u540c\u3002<\/p>\n<p>5\uff09ps e \u5217\u51fa\u7a0b\u5e8f\u65f6\uff0c\u663e\u793a\u6bcf\u4e2a\u7a0b\u5e8f\u6240\u4f7f\u7528\u7684\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<p>6\uff09ps f \u7528ASCII\u5b57\u7b26\u663e\u793a\u6811\u72b6\u7ed3\u6784\uff0c\u8868\u8fbe\u7a0b\u5e8f\u95f4\u7684\u76f8\u4e92\u5173\u7cfb\u3002<\/p>\n<p>7\uff09ps -H \u663e\u793a\u6811\u72b6\u7ed3\u6784\uff0c\u8868\u793a\u7a0b\u5e8f\u95f4\u7684\u76f8\u4e92\u5173\u7cfb\u3002<\/p>\n<p>8\uff09ps -N \u663e\u793a\u6240\u6709\u7684\u7a0b\u5e8f\uff0c\u9664\u4e86\u6267\u884cps\u6307\u4ee4\u7ec8\u7aef\u673a\u4e0b\u7684\u7a0b\u5e8f\u4e4b\u5916\u3002<\/p>\n<p>9\uff09ps s \u91c7\u7528\u7a0b\u5e8f\u4fe1\u53f7\u7684\u683c\u5f0f\u663e\u793a\u7a0b\u5e8f\u72b6\u51b5\u3002<\/p>\n<p>10\uff09ps S \u5217\u51fa\u7a0b\u5e8f\u65f6\uff0c\u5305\u62ec\u5df2\u4e2d\u65ad\u7684\u5b50\u7a0b\u5e8f\u8d44\u6599\u3002<\/p>\n<p>11\uff09ps -t&lt;\u7ec8\u7aef\u673a\u7f16\u53f7&gt; \u3000\u6307\u5b9a\u7ec8\u7aef\u673a\u7f16\u53f7\uff0c\u5e76\u5217\u51fa\u5c5e\u4e8e\u8be5\u7ec8\u7aef\u673a\u7684\u7a0b\u5e8f\u7684\u72b6\u51b5\u3002<\/p>\n<p>12\uff09ps u \u3000\u4ee5\u7528\u6237\u4e3a\u4e3b\u7684\u683c\u5f0f\u6765\u663e\u793a\u7a0b\u5e8f\u72b6\u51b5\u3002<\/p>\n<p>13\uff09ps x \u3000\u663e\u793a\u6240\u6709\u7a0b\u5e8f\uff0c\u4e0d\u4ee5\u7ec8\u7aef\u673a\u6765\u533a\u5206\u3002<\/p>\n<p>\u5e38\u7528\u6307\u4ee4\u7ec4\u5408 \uff1aps aux,\u7136\u540e\u518d\u901a\u8fc7\u7ba1\u9053\u4f7f\u7528grep\u547d\u4ee4\u8fc7\u6ee4\u67e5\u627e\u7279\u5b9a\u7684\u8fdb\u7a0b,\u7136\u540e\u518d\u5bf9\u7279\u5b9a\u7684\u8fdb\u7a0b\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p>ps aux | grep program_filter_word,ps -ef |grep tomcat<\/p>\n<p>ps -ef|grep java|grep -v grep \u663e\u793a\u51fa\u6240\u6709\u7684java\u8fdb\u7a0b\uff0c\u53bb\u5904\u6389\u5f53\u524d\u7684grep\u8fdb\u7a0b\u3002<\/p>\n<p>\u5173\u673a (\u7cfb\u7edf\u7684\u5173\u673a\u3001\u91cd\u542f\u4ee5\u53ca\u767b\u51fa )<\/p>\n<p>shutdown -h now \u5173\u95ed\u7cfb\u7edf(1)<\/p>\n<p>init 0 \u5173\u95ed\u7cfb\u7edf(2)<\/p>\n<p>telinit 0 \u5173\u95ed\u7cfb\u7edf(3)<\/p>\n<p>shutdown -h hours:minutes &amp; \u6309\u9884\u5b9a\u65f6\u95f4\u5173\u95ed\u7cfb\u7edf<\/p>\n<p>shutdown -c \u53d6\u6d88\u6309\u9884\u5b9a\u65f6\u95f4\u5173\u95ed\u7cfb\u7edf<\/p>\n<p>shutdown -r now \u91cd\u542f(1)<\/p>\n<p>reboot \u91cd\u542f(2)<\/p>\n<p>logout \u6ce8\u9500<\/p>\n<p>\u6587\u4ef6\u548c\u76ee\u5f55<\/p>\n<p>cd \/home \u8fdb\u5165 &#8216;\/ home&#8217; \u76ee\u5f55&#8217;<\/p>\n<p>cd .. \u8fd4\u56de\u4e0a\u4e00\u7ea7\u76ee\u5f55<\/p>\n<p>cd ..\/.. \u8fd4\u56de\u4e0a\u4e24\u7ea7\u76ee\u5f55<\/p>\n<p>cd \u8fdb\u5165\u4e2a\u4eba\u7684\u4e3b\u76ee\u5f55<\/p>\n<p>cd ~user1 \u8fdb\u5165\u4e2a\u4eba\u7684\u4e3b\u76ee\u5f55<\/p>\n<p>cd &#8211; \u8fd4\u56de\u4e0a\u6b21\u6240\u5728\u7684\u76ee\u5f55<\/p>\n<p>pwd \u663e\u793a\u5de5\u4f5c\u8def\u5f84<\/p>\n<p>ls \u67e5\u770b\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6<\/p>\n<p>ls -F \u67e5\u770b\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6<\/p>\n<p>ls -l \u663e\u793a\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u8be6\u7ec6\u8d44\u6599<\/p>\n<p>ls -a \u663e\u793a\u9690\u85cf\u6587\u4ef6<\/p>\n<p>ls *[0-9]* \u663e\u793a\u5305\u542b\u6570\u5b57\u7684\u6587\u4ef6\u540d\u548c\u76ee\u5f55\u540d<\/p>\n<p>tree \u663e\u793a\u6587\u4ef6\u548c\u76ee\u5f55\u7531\u6839\u76ee\u5f55\u5f00\u59cb\u7684\u6811\u5f62\u7ed3\u6784(1)<\/p>\n<p>lstree \u663e\u793a\u6587\u4ef6\u548c\u76ee\u5f55\u7531\u6839\u76ee\u5f55\u5f00\u59cb\u7684\u6811\u5f62\u7ed3\u6784(2)<\/p>\n<p>mkdir dir1 \u521b\u5efa\u4e00\u4e2a\u53eb\u505a &#8216;dir1&#8242; \u7684\u76ee\u5f55&#8217;<\/p>\n<p>mkdir dir1 dir2 \u540c\u65f6\u521b\u5efa\u4e24\u4e2a\u76ee\u5f55<\/p>\n<p>mkdir -p \/tmp\/dir1\/dir2 \u521b\u5efa\u4e00\u4e2a\u76ee\u5f55\u6811<\/p>\n<p>rm -f file1 \u5220\u9664\u4e00\u4e2a\u53eb\u505a &#8216;file1&#8242; \u7684\u6587\u4ef6&#8217;<\/p>\n<p>rmdir dir1 \u5220\u9664\u4e00\u4e2a\u53eb\u505a &#8216;dir1&#8242; \u7684\u76ee\u5f55&#8217;<\/p>\n<p>rm -rf dir1 \u5220\u9664\u4e00\u4e2a\u53eb\u505a &#8216;dir1&#8217; \u7684\u76ee\u5f55\u5e76\u540c\u65f6\u5220\u9664\u5176\u5185\u5bb9<\/p>\n<p>rm -rf dir1 dir2 \u540c\u65f6\u5220\u9664\u4e24\u4e2a\u76ee\u5f55\u53ca\u5b83\u4eec\u7684\u5185\u5bb9<\/p>\n<p>mv dir1 new_dir \u91cd\u547d\u540d\/\u79fb\u52a8 \u4e00\u4e2a\u76ee\u5f55<\/p>\n<p>cp file1 file2 \u590d\u5236\u4e00\u4e2a\u6587\u4ef6<\/p>\n<p>cp dir\/* . \u590d\u5236\u4e00\u4e2a\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u5230\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55<\/p>\n<p>cp -a \/tmp\/dir1 . \u590d\u5236\u4e00\u4e2a\u76ee\u5f55\u5230\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55<\/p>\n<p>cp -a dir1 dir2 \u590d\u5236\u4e00\u4e2a\u76ee\u5f55<\/p>\n<p>ln -s file1 lnk1 \u521b\u5efa\u4e00\u4e2a\u6307\u5411\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u8f6f\u94fe\u63a5<\/p>\n<p>ln file1 lnk1 \u521b\u5efa\u4e00\u4e2a\u6307\u5411\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u7269\u7406\u94fe\u63a5<\/p>\n<p>touch -t 0712250000 file1 \u4fee\u6539\u4e00\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u65f6\u95f4\u6233 &#8211; (YYMMDDhhmm)<\/p>\n<p>file file1 outputs the mime type of the file as text<\/p>\n<p>iconv -l \u5217\u51fa\u5df2\u77e5\u7684\u7f16\u7801<\/p>\n<p>iconv -f fromEncoding -t toEncoding inputFile &gt; outputFile creates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.<\/p>\n<p>find . -maxdepth 1 -name *.jpg -print -exec convert &#8220;{}&#8221; -resize 80&#215;60 &#8220;thumbs\/{}&#8221; \\; batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)<\/p>\n<p>\u6587\u4ef6\u641c\u7d22<\/p>\n<p>find \/ -name file1 \u4ece &#8216;\/&#8217; \u5f00\u59cb\u8fdb\u5165\u6839\u6587\u4ef6\u7cfb\u7edf\u641c\u7d22\u6587\u4ef6\u548c\u76ee\u5f55<\/p>\n<p>find \/ -user user1 \u641c\u7d22\u5c5e\u4e8e\u7528\u6237 &#8216;user1&#8217; \u7684\u6587\u4ef6\u548c\u76ee\u5f55<\/p>\n<p>find \/home\/user1 -name \\*.bin \u5728\u76ee\u5f55 &#8216;\/ home\/user1&#8242; \u4e2d\u641c\u7d22\u5e26\u6709&#8217;.bin&#8217; \u7ed3\u5c3e\u7684\u6587\u4ef6<\/p>\n<p>find \/usr\/bin -type f -atime +100 \u641c\u7d22\u5728\u8fc7\u53bb100\u5929\u5185\u672a\u88ab\u4f7f\u7528\u8fc7\u7684\u6267\u884c\u6587\u4ef6<\/p>\n<p>find \/usr\/bin -type f -mtime -10 \u641c\u7d22\u572810\u5929\u5185\u88ab\u521b\u5efa\u6216\u8005\u4fee\u6539\u8fc7\u7684\u6587\u4ef6<\/p>\n<p>find \/ -name \\*.rpm -exec chmod 755 &#8216;{}&#8217; \\; \u641c\u7d22\u4ee5 &#8216;.rpm&#8217; \u7ed3\u5c3e\u7684\u6587\u4ef6\u5e76\u5b9a\u4e49\u5176\u6743\u9650<\/p>\n<p>find \/ -xdev -name \\*.rpm \u641c\u7d22\u4ee5 &#8216;.rpm&#8217; \u7ed3\u5c3e\u7684\u6587\u4ef6\uff0c\u5ffd\u7565\u5149\u9a71\u3001\u6377\u76d8\u7b49\u53ef\u79fb\u52a8\u8bbe\u5907<\/p>\n<p>locate \\*.ps \u5bfb\u627e\u4ee5 &#8216;.ps&#8217; \u7ed3\u5c3e\u7684\u6587\u4ef6 &#8211; \u5148\u8fd0\u884c &#8216;updatedb&#8217; \u547d\u4ee4<\/p>\n<p>whereis halt \u663e\u793a\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\u3001\u6e90\u7801\u6216man\u7684\u4f4d\u7f6e<\/p>\n<p>which halt \u663e\u793a\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\u6216\u53ef\u6267\u884c\u6587\u4ef6\u7684\u5b8c\u6574\u8def\u5f84<\/p>\n<p>\u6302\u8f7d\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mount \/dev\/hda2 \/mnt\/hda2 \u6302\u8f7d\u4e00\u4e2a\u53eb\u505ahda2\u7684\u76d8 &#8211; \u786e\u5b9a\u76ee\u5f55 &#8216;\/ mnt\/hda2&#8217; \u5df2\u7ecf\u5b58\u5728<\/p>\n<p>umount \/dev\/hda2 \u5378\u8f7d\u4e00\u4e2a\u53eb\u505ahda2\u7684\u76d8 &#8211; \u5148\u4ece\u6302\u8f7d\u70b9 &#8216;\/ mnt\/hda2&#8217; \u9000\u51fa<\/p>\n<p>fuser -km \/mnt\/hda2 \u5f53\u8bbe\u5907\u7e41\u5fd9\u65f6\u5f3a\u5236\u5378\u8f7d<\/p>\n<p>umount -n \/mnt\/hda2 \u8fd0\u884c\u5378\u8f7d\u64cd\u4f5c\u800c\u4e0d\u5199\u5165 \/etc\/mtab \u6587\u4ef6- \u5f53\u6587\u4ef6\u4e3a\u53ea\u8bfb\u6216\u5f53\u78c1\u76d8\u5199\u6ee1\u65f6\u975e\u5e38\u6709\u7528<\/p>\n<p>mount \/dev\/fd0 \/mnt\/floppy \u6302\u8f7d\u4e00\u4e2a\u8f6f\u76d8<\/p>\n<p>mount \/dev\/cdrom \/mnt\/cdrom \u6302\u8f7d\u4e00\u4e2acdrom\u6216dvdrom<\/p>\n<p>mount \/dev\/hdc \/mnt\/cdrecorder \u6302\u8f7d\u4e00\u4e2acdrw\u6216dvdrom<\/p>\n<p>mount \/dev\/hdb \/mnt\/cdrecorder \u6302\u8f7d\u4e00\u4e2acdrw\u6216dvdrom<\/p>\n<p>mount -o loop file.iso \/mnt\/cdrom \u6302\u8f7d\u4e00\u4e2a\u6587\u4ef6\u6216ISO\u955c\u50cf\u6587\u4ef6<\/p>\n<p>mount -t vfat \/dev\/hda5 \/mnt\/hda5 \u6302\u8f7d\u4e00\u4e2aWindows FAT32\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mount \/dev\/sda1 \/mnt\/usbdisk \u6302\u8f7d\u4e00\u4e2ausb \u6377\u76d8\u6216\u95ea\u5b58\u8bbe\u5907<\/p>\n<p>mount -t smbfs -o username=user,password=pass \/\/WinClient\/share \/mnt\/share \u6302\u8f7d\u4e00\u4e2awindows\u7f51\u7edc\u5171\u4eab<\/p>\n<p>\u78c1\u76d8\u7a7a\u95f4<\/p>\n<p>df -h \u663e\u793a\u5df2\u7ecf\u6302\u8f7d\u7684\u5206\u533a\u5217\u8868<\/p>\n<p>ls -lSr |more \u4ee5\u5c3a\u5bf8\u5927\u5c0f\u6392\u5217\u6587\u4ef6\u548c\u76ee\u5f55<\/p>\n<p>du -sh dir1 \u4f30\u7b97\u76ee\u5f55 &#8216;dir1&#8242; \u5df2\u7ecf\u4f7f\u7528\u7684\u78c1\u76d8\u7a7a\u95f4&#8217;<\/p>\n<p>du -sk * | sort -rn \u4ee5\u5bb9\u91cf\u5927\u5c0f\u4e3a\u4f9d\u636e\u4f9d\u6b21\u663e\u793a\u6587\u4ef6\u548c\u76ee\u5f55\u7684\u5927\u5c0f<\/p>\n<p>rpm -q -a &#8211;qf &#8216;%10{SIZE}t%{NAME}n&#8217; | sort -k1,1n \u4ee5\u5927\u5c0f\u4e3a\u4f9d\u636e\u4f9d\u6b21\u663e\u793a\u5df2\u5b89\u88c5\u7684rpm\u5305\u6240\u4f7f\u7528\u7684\u7a7a\u95f4 (fedora, redhat\u7c7b\u7cfb\u7edf)<\/p>\n<p>dpkg-query -W -f=&#8217;${Installed-Size;10}t${Package}n&#8217; | sort -k1,1n \u4ee5\u5927\u5c0f\u4e3a\u4f9d\u636e\u663e\u793a\u5df2\u5b89\u88c5\u7684deb\u5305\u6240\u4f7f\u7528\u7684\u7a7a\u95f4 (ubuntu, debian\u7c7b\u7cfb\u7edf)<\/p>\n<p>\u7528\u6237\u548c\u7fa4\u7ec4<\/p>\n<p>groupadd group_name \u521b\u5efa\u4e00\u4e2a\u65b0\u7528\u6237\u7ec4<\/p>\n<p>groupdel group_name \u5220\u9664\u4e00\u4e2a\u7528\u6237\u7ec4<\/p>\n<p>groupmod -n new_group_name old_group_name \u91cd\u547d\u540d\u4e00\u4e2a\u7528\u6237\u7ec4<\/p>\n<p>useradd -c &#8220;Name Surname &#8221; -g admin -d \/home\/user1 -s \/bin\/bash user1 \u521b\u5efa\u4e00\u4e2a\u5c5e\u4e8e &#8220;admin&#8221; \u7528\u6237\u7ec4\u7684\u7528\u6237<\/p>\n<p>useradd user1 \u521b\u5efa\u4e00\u4e2a\u65b0\u7528\u6237<\/p>\n<p>userdel -r user1 \u5220\u9664\u4e00\u4e2a\u7528\u6237 ( &#8216;-r&#8217; \u6392\u9664\u4e3b\u76ee\u5f55)<\/p>\n<p>usermod -c &#8220;User FTP&#8221; -g system -d \/ftp\/user1 -s \/bin\/nologin user1 \u4fee\u6539\u7528\u6237\u5c5e\u6027<\/p>\n<p>passwd \u4fee\u6539\u53e3\u4ee4<\/p>\n<p>passwd user1 \u4fee\u6539\u4e00\u4e2a\u7528\u6237\u7684\u53e3\u4ee4 (\u53ea\u5141\u8bb8root\u6267\u884c)<\/p>\n<p>chage -E 2005-12-31 user1 \u8bbe\u7f6e\u7528\u6237\u53e3\u4ee4\u7684\u5931\u6548\u671f\u9650<\/p>\n<p>pwck \u68c0\u67e5 &#8216;\/etc\/passwd&#8217; \u7684\u6587\u4ef6\u683c\u5f0f\u548c\u8bed\u6cd5\u4fee\u6b63\u4ee5\u53ca\u5b58\u5728\u7684\u7528\u6237<\/p>\n<p>grpck \u68c0\u67e5 &#8216;\/etc\/passwd&#8217; \u7684\u6587\u4ef6\u683c\u5f0f\u548c\u8bed\u6cd5\u4fee\u6b63\u4ee5\u53ca\u5b58\u5728\u7684\u7fa4\u7ec4<\/p>\n<p>newgrp group_name \u767b\u9646\u8fdb\u4e00\u4e2a\u65b0\u7684\u7fa4\u7ec4\u4ee5\u6539\u53d8\u65b0\u521b\u5efa\u6587\u4ef6\u7684\u9884\u8bbe\u7fa4\u7ec4<\/p>\n<p>\u6587\u4ef6\u7684\u6743\u9650 &#8211; \u4f7f\u7528 &#8220;+&#8221; \u8bbe\u7f6e\u6743\u9650\uff0c\u4f7f\u7528 &#8220;-&#8221; \u7528\u4e8e\u53d6\u6d88<\/p>\n<p>ls -lh \u663e\u793a\u6743\u9650<\/p>\n<p>ls \/tmp | pr -T5 -W$COLUMNS \u5c06\u7ec8\u7aef\u5212\u5206\u62105\u680f\u663e\u793a<\/p>\n<p>chmod ugo+rwx directory1 \u8bbe\u7f6e\u76ee\u5f55\u7684\u6240\u6709\u4eba(u)\u3001\u7fa4\u7ec4(g)\u4ee5\u53ca\u5176\u4ed6\u4eba(o)\u4ee5\u8bfb\uff08r \uff09\u3001\u5199(w)\u548c\u6267\u884c(x)\u7684\u6743\u9650<\/p>\n<p>chmod go-rwx directory1 \u5220\u9664\u7fa4\u7ec4(g)\u4e0e\u5176\u4ed6\u4eba(o)\u5bf9\u76ee\u5f55\u7684\u8bfb\u5199\u6267\u884c\u6743\u9650<\/p>\n<p>chown user1 file1 \u6539\u53d8\u4e00\u4e2a\u6587\u4ef6\u7684\u6240\u6709\u4eba\u5c5e\u6027<\/p>\n<p>chown -R user1 directory1 \u6539\u53d8\u4e00\u4e2a\u76ee\u5f55\u7684\u6240\u6709\u4eba\u5c5e\u6027\u5e76\u540c\u65f6\u6539\u53d8\u6539\u76ee\u5f55\u4e0b\u6240\u6709\u6587\u4ef6\u7684\u5c5e\u6027<\/p>\n<p>chgrp group1 file1 \u6539\u53d8\u6587\u4ef6\u7684\u7fa4\u7ec4<\/p>\n<p>chown user1:group1 file1 \u6539\u53d8\u4e00\u4e2a\u6587\u4ef6\u7684\u6240\u6709\u4eba\u548c\u7fa4\u7ec4\u5c5e\u6027<\/p>\n<p>find \/ -perm -u+s \u7f57\u5217\u4e00\u4e2a\u7cfb\u7edf\u4e2d\u6240\u6709\u4f7f\u7528\u4e86SUID\u63a7\u5236\u7684\u6587\u4ef6<\/p>\n<p>chmod u+s \/bin\/file1 \u8bbe\u7f6e\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684 SUID \u4f4d &#8211; \u8fd0\u884c\u8be5\u6587\u4ef6\u7684\u7528\u6237\u4e5f\u88ab\u8d4b\u4e88\u548c\u6240\u6709\u8005\u540c\u6837\u7684\u6743\u9650<\/p>\n<p>chmod u-s \/bin\/file1 \u7981\u7528\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684 SUID\u4f4d<\/p>\n<p>chmod g+s \/home\/public \u8bbe\u7f6e\u4e00\u4e2a\u76ee\u5f55\u7684SGID \u4f4d &#8211; \u7c7b\u4f3cSUID \uff0c\u4e0d\u8fc7\u8fd9\u662f\u9488\u5bf9\u76ee\u5f55\u7684<\/p>\n<p>chmod g-s \/home\/public \u7981\u7528\u4e00\u4e2a\u76ee\u5f55\u7684 SGID \u4f4d<\/p>\n<p>chmod o+t \/home\/public \u8bbe\u7f6e\u4e00\u4e2a\u6587\u4ef6\u7684 STIKY \u4f4d &#8211; \u53ea\u5141\u8bb8\u5408\u6cd5\u6240\u6709\u4eba\u5220\u9664\u6587\u4ef6<\/p>\n<p>chmod o-t \/home\/public \u7981\u7528\u4e00\u4e2a\u76ee\u5f55\u7684 STIKY \u4f4d<\/p>\n<p>\u6587\u4ef6\u7684\u7279\u6b8a\u5c5e\u6027 &#8211; \u4f7f\u7528 &#8220;+&#8221; \u8bbe\u7f6e\u6743\u9650\uff0c\u4f7f\u7528 &#8220;-&#8221; \u7528\u4e8e\u53d6\u6d88<\/p>\n<p>chattr +a file1 \u53ea\u5141\u8bb8\u4ee5\u8ffd\u52a0\u65b9\u5f0f\u8bfb\u5199\u6587\u4ef6<\/p>\n<p>chattr +c file1 \u5141\u8bb8\u8fd9\u4e2a\u6587\u4ef6\u80fd\u88ab\u5185\u6838\u81ea\u52a8\u538b\u7f29\/\u89e3\u538b<\/p>\n<p>chattr +d file1 \u5728\u8fdb\u884c\u6587\u4ef6\u7cfb\u7edf\u5907\u4efd\u65f6\uff0cdump\u7a0b\u5e8f\u5c06\u5ffd\u7565\u8fd9\u4e2a\u6587\u4ef6<\/p>\n<p>chattr +i file1 \u8bbe\u7f6e\u6210\u4e0d\u53ef\u53d8\u7684\u6587\u4ef6\uff0c\u4e0d\u80fd\u88ab\u5220\u9664\u3001\u4fee\u6539\u3001\u91cd\u547d\u540d\u6216\u8005\u94fe\u63a5<\/p>\n<p>chattr +s file1 \u5141\u8bb8\u4e00\u4e2a\u6587\u4ef6\u88ab\u5b89\u5168\u5730\u5220\u9664<\/p>\n<p>chattr +S file1 \u4e00\u65e6\u5e94\u7528\u7a0b\u5e8f\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u6267\u884c\u4e86\u5199\u64cd\u4f5c\uff0c\u4f7f\u7cfb\u7edf\u7acb\u523b\u628a\u4fee\u6539\u7684\u7ed3\u679c\u5199\u5230\u78c1\u76d8<\/p>\n<p>chattr +u file1 \u82e5\u6587\u4ef6\u88ab\u5220\u9664\uff0c\u7cfb\u7edf\u4f1a\u5141\u8bb8\u4f60\u5728\u4ee5\u540e\u6062\u590d\u8fd9\u4e2a\u88ab\u5220\u9664\u7684\u6587\u4ef6<\/p>\n<p>lsattr \u663e\u793a\u7279\u6b8a\u7684\u5c5e\u6027<\/p>\n<p>\u6253\u5305\u548c\u538b\u7f29\u6587\u4ef6<\/p>\n<p>bunzip2 file1.bz2 \u89e3\u538b\u4e00\u4e2a\u53eb\u505a &#8216;file1.bz2&#8217;\u7684\u6587\u4ef6<\/p>\n<p>bzip2 file1 \u538b\u7f29\u4e00\u4e2a\u53eb\u505a &#8216;file1&#8217; \u7684\u6587\u4ef6<\/p>\n<p>gunzip file1.gz \u89e3\u538b\u4e00\u4e2a\u53eb\u505a &#8216;file1.gz&#8217;\u7684\u6587\u4ef6<\/p>\n<p>gzip file1 \u538b\u7f29\u4e00\u4e2a\u53eb\u505a &#8216;file1&#8217;\u7684\u6587\u4ef6<\/p>\n<p>gzip -9 file1 \u6700\u5927\u7a0b\u5ea6\u538b\u7f29<\/p>\n<p>rar a file1.rar test_file \u521b\u5efa\u4e00\u4e2a\u53eb\u505a &#8216;file1.rar&#8217; \u7684\u5305<\/p>\n<p>rar a file1.rar file1 file2 dir1 \u540c\u65f6\u538b\u7f29 &#8216;file1&#8217;, &#8216;file2&#8217; \u4ee5\u53ca\u76ee\u5f55 &#8216;dir1&#8217;<\/p>\n<p>rar x file1.rar \u89e3\u538brar\u5305<\/p>\n<p>unrar x file1.rar \u89e3\u538brar\u5305<\/p>\n<p>tar -cvf archive.tar file1 \u521b\u5efa\u4e00\u4e2a\u975e\u538b\u7f29\u7684 tarball<\/p>\n<p>tar -cvf archive.tar file1 file2 dir1 \u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4e86 &#8216;file1&#8217;, &#8216;file2&#8217; \u4ee5\u53ca &#8216;dir1&#8217;\u7684\u6863\u6848\u6587\u4ef6<\/p>\n<p>tar -tf archive.tar \u663e\u793a\u4e00\u4e2a\u5305\u4e2d\u7684\u5185\u5bb9<\/p>\n<p>tar -xvf archive.tar \u91ca\u653e\u4e00\u4e2a\u5305<\/p>\n<p>tar -xvf archive.tar -C \/tmp \u5c06\u538b\u7f29\u5305\u91ca\u653e\u5230 \/tmp\u76ee\u5f55\u4e0b<\/p>\n<p>tar -cvfj archive.tar.bz2 dir1 \u521b\u5efa\u4e00\u4e2abzip2\u683c\u5f0f\u7684\u538b\u7f29\u5305<\/p>\n<p>tar -xvfj archive.tar.bz2 \u89e3\u538b\u4e00\u4e2abzip2\u683c\u5f0f\u7684\u538b\u7f29\u5305<\/p>\n<p>tar -cvfz archive.tar.gz dir1 \u521b\u5efa\u4e00\u4e2agzip\u683c\u5f0f\u7684\u538b\u7f29\u5305<\/p>\n<p>tar -xvfz archive.tar.gz \u89e3\u538b\u4e00\u4e2agzip\u683c\u5f0f\u7684\u538b\u7f29\u5305<\/p>\n<p>zip\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/file1.zip\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">file1.zip<\/a>\u00a0file1 \u521b\u5efa\u4e00\u4e2azip\u683c\u5f0f\u7684\u538b\u7f29\u5305<\/p>\n<p>zip -r\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/file1.zip\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">file1.zip<\/a>\u00a0file1 file2 dir1 \u5c06\u51e0\u4e2a\u6587\u4ef6\u548c\u76ee\u5f55\u540c\u65f6\u538b\u7f29\u6210\u4e00\u4e2azip\u683c\u5f0f\u7684\u538b\u7f29\u5305<\/p>\n<p>unzip\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/file1.zip\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">file1.zip<\/a>\u00a0\u89e3\u538b\u4e00\u4e2azip\u683c\u5f0f\u538b\u7f29\u5305<\/p>\n<p>RPM \u5305 &#8211; \uff08Fedora, Redhat\u53ca\u7c7b\u4f3c\u7cfb\u7edf\uff09<\/p>\n<p>rpm -ivh package.rpm \u5b89\u88c5\u4e00\u4e2arpm\u5305<\/p>\n<p>rpm -ivh &#8211;nodeeps package.rpm \u5b89\u88c5\u4e00\u4e2arpm\u5305\u800c\u5ffd\u7565\u4f9d\u8d56\u5173\u7cfb\u8b66\u544a<\/p>\n<p>rpm -U package.rpm \u66f4\u65b0\u4e00\u4e2arpm\u5305\u4f46\u4e0d\u6539\u53d8\u5176\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>rpm -F package.rpm \u66f4\u65b0\u4e00\u4e2a\u786e\u5b9a\u5df2\u7ecf\u5b89\u88c5\u7684rpm\u5305<\/p>\n<p>rpm -e package_name.rpm \u5220\u9664\u4e00\u4e2arpm\u5305<\/p>\n<p>rpm -qa \u663e\u793a\u7cfb\u7edf\u4e2d\u6240\u6709\u5df2\u7ecf\u5b89\u88c5\u7684rpm\u5305<\/p>\n<p>rpm -qa | grep httpd \u663e\u793a\u6240\u6709\u540d\u79f0\u4e2d\u5305\u542b &#8220;httpd&#8221; \u5b57\u6837\u7684rpm\u5305<\/p>\n<p>rpm -qi package_name \u83b7\u53d6\u4e00\u4e2a\u5df2\u5b89\u88c5\u5305\u7684\u7279\u6b8a\u4fe1\u606f<\/p>\n<p>rpm -qg &#8220;System Environment\/Daemons&#8221; \u663e\u793a\u4e00\u4e2a\u7ec4\u4ef6\u7684rpm\u5305<\/p>\n<p>rpm -ql package_name \u663e\u793a\u4e00\u4e2a\u5df2\u7ecf\u5b89\u88c5\u7684rpm\u5305\u63d0\u4f9b\u7684\u6587\u4ef6\u5217\u8868<\/p>\n<p>rpm -qc package_name \u663e\u793a\u4e00\u4e2a\u5df2\u7ecf\u5b89\u88c5\u7684rpm\u5305\u63d0\u4f9b\u7684\u914d\u7f6e\u6587\u4ef6\u5217\u8868<\/p>\n<p>rpm -q package_name &#8211;whatrequires \u663e\u793a\u4e0e\u4e00\u4e2arpm\u5305\u5b58\u5728\u4f9d\u8d56\u5173\u7cfb\u7684\u5217\u8868<\/p>\n<p>rpm -q package_name &#8211;whatprovides \u663e\u793a\u4e00\u4e2arpm\u5305\u6240\u5360\u7684\u4f53\u79ef<\/p>\n<p>rpm -q package_name &#8211;scripts \u663e\u793a\u5728\u5b89\u88c5\/\u5220\u9664\u671f\u95f4\u6240\u6267\u884c\u7684\u811a\u672cl<\/p>\n<p>rpm -q package_name &#8211;changelog \u663e\u793a\u4e00\u4e2arpm\u5305\u7684\u4fee\u6539\u5386\u53f2<\/p>\n<p>rpm -qf \/etc\/httpd\/conf\/httpd.conf \u786e\u8ba4\u6240\u7ed9\u7684\u6587\u4ef6\u7531\u54ea\u4e2arpm\u5305\u6240\u63d0\u4f9b<\/p>\n<p>rpm -qp package.rpm -l \u663e\u793a\u7531\u4e00\u4e2a\u5c1a\u672a\u5b89\u88c5\u7684rpm\u5305\u63d0\u4f9b\u7684\u6587\u4ef6\u5217\u8868<\/p>\n<p>rpm &#8211;import \/media\/cdrom\/RPM-GPG-KEY \u5bfc\u5165\u516c\u94a5\u6570\u5b57\u8bc1\u4e66<\/p>\n<p>rpm &#8211;checksig package.rpm \u786e\u8ba4\u4e00\u4e2arpm\u5305\u7684\u5b8c\u6574\u6027<\/p>\n<p>rpm -qa gpg-pubkey \u786e\u8ba4\u5df2\u5b89\u88c5\u7684\u6240\u6709rpm\u5305\u7684\u5b8c\u6574\u6027<\/p>\n<p>rpm -V package_name \u68c0\u67e5\u6587\u4ef6\u5c3a\u5bf8\u3001 \u8bb8\u53ef\u3001\u7c7b\u578b\u3001\u6240\u6709\u8005\u3001\u7fa4\u7ec4\u3001MD5\u68c0\u67e5\u4ee5\u53ca\u6700\u540e\u4fee\u6539\u65f6\u95f4<\/p>\n<p>rpm -Va \u68c0\u67e5\u7cfb\u7edf\u4e2d\u6240\u6709\u5df2\u5b89\u88c5\u7684rpm\u5305- \u5c0f\u5fc3\u4f7f\u7528<\/p>\n<p>rpm -Vp package.rpm \u786e\u8ba4\u4e00\u4e2arpm\u5305\u8fd8\u672a\u5b89\u88c5<\/p>\n<p>rpm2cpio package.rpm | cpio &#8211;extract &#8211;make-directories *bin* \u4ece\u4e00\u4e2arpm\u5305\u8fd0\u884c\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<p>rpm -ivh \/usr\/src\/redhat\/RPMS\/`arch`\/package.rpm \u4ece\u4e00\u4e2arpm\u6e90\u7801\u5b89\u88c5\u4e00\u4e2a\u6784\u5efa\u597d\u7684\u5305<\/p>\n<p>rpmbuild &#8211;rebuild package_name.src.rpm \u4ece\u4e00\u4e2arpm\u6e90\u7801\u6784\u5efa\u4e00\u4e2a rpm \u5305<\/p>\n<p>YUM \u8f6f\u4ef6\u5305\u5347\u7ea7\u5668 &#8211; \uff08Fedora, RedHat\u53ca\u7c7b\u4f3c\u7cfb\u7edf\uff09<\/p>\n<p>yum install package_name \u4e0b\u8f7d\u5e76\u5b89\u88c5\u4e00\u4e2arpm\u5305<\/p>\n<p>yum localinstall package_name.rpm \u5c06\u5b89\u88c5\u4e00\u4e2arpm\u5305\uff0c\u4f7f\u7528\u4f60\u81ea\u5df1\u7684\u8f6f\u4ef6\u4ed3\u5e93\u4e3a\u4f60\u89e3\u51b3\u6240\u6709\u4f9d\u8d56\u5173\u7cfb<\/p>\n<p>yum update package_name.rpm \u66f4\u65b0\u5f53\u524d\u7cfb\u7edf\u4e2d\u6240\u6709\u5b89\u88c5\u7684rpm\u5305<\/p>\n<p>yum update package_name \u66f4\u65b0\u4e00\u4e2arpm\u5305<\/p>\n<p>yum remove package_name \u5220\u9664\u4e00\u4e2arpm\u5305<\/p>\n<p>yum list \u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684\u6240\u6709\u5305<\/p>\n<p>yum search package_name \u5728rpm\u4ed3\u5e93\u4e2d\u641c\u5bfb\u8f6f\u4ef6\u5305<\/p>\n<p>yum clean packages \u6e05\u7406rpm\u7f13\u5b58\u5220\u9664\u4e0b\u8f7d\u7684\u5305<\/p>\n<p>yum clean headers \u5220\u9664\u6240\u6709\u5934\u6587\u4ef6<\/p>\n<p>yum clean all \u5220\u9664\u6240\u6709\u7f13\u5b58\u7684\u5305\u548c\u5934\u6587\u4ef6<\/p>\n<p>DEB \u5305 (Debian, Ubuntu \u4ee5\u53ca\u7c7b\u4f3c\u7cfb\u7edf)<\/p>\n<p>dpkg -i package.deb \u5b89\u88c5\/\u66f4\u65b0\u4e00\u4e2a deb \u5305<\/p>\n<p>dpkg -r package_name \u4ece\u7cfb\u7edf\u5220\u9664\u4e00\u4e2a deb \u5305<\/p>\n<p>dpkg -l \u663e\u793a\u7cfb\u7edf\u4e2d\u6240\u6709\u5df2\u7ecf\u5b89\u88c5\u7684 deb \u5305<\/p>\n<p>dpkg -l | grep httpd \u663e\u793a\u6240\u6709\u540d\u79f0\u4e2d\u5305\u542b &#8220;httpd&#8221; \u5b57\u6837\u7684deb\u5305<\/p>\n<p>dpkg -s package_name \u83b7\u5f97\u5df2\u7ecf\u5b89\u88c5\u5728\u7cfb\u7edf\u4e2d\u4e00\u4e2a\u7279\u6b8a\u5305\u7684\u4fe1\u606f<\/p>\n<p>dpkg -L package_name \u663e\u793a\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u5b89\u88c5\u7684\u4e00\u4e2adeb\u5305\u6240\u63d0\u4f9b\u7684\u6587\u4ef6\u5217\u8868<\/p>\n<p>dpkg &#8211;contents package.deb \u663e\u793a\u5c1a\u672a\u5b89\u88c5\u7684\u4e00\u4e2a\u5305\u6240\u63d0\u4f9b\u7684\u6587\u4ef6\u5217\u8868<\/p>\n<p>dpkg -S \/bin\/ping \u786e\u8ba4\u6240\u7ed9\u7684\u6587\u4ef6\u7531\u54ea\u4e2adeb\u5305\u63d0\u4f9b<\/p>\n<p>APT \u8f6f\u4ef6\u5de5\u5177 (Debian, Ubuntu \u4ee5\u53ca\u7c7b\u4f3c\u7cfb\u7edf)<\/p>\n<p>apt-get install package_name \u5b89\u88c5\/\u66f4\u65b0\u4e00\u4e2a deb \u5305<\/p>\n<p>apt-cdrom install package_name \u4ece\u5149\u76d8\u5b89\u88c5\/\u66f4\u65b0\u4e00\u4e2a deb \u5305<\/p>\n<p>apt-get update \u5347\u7ea7\u5217\u8868\u4e2d\u7684\u8f6f\u4ef6\u5305<\/p>\n<p>apt-get upgrade \u5347\u7ea7\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6<\/p>\n<p>apt-get remove package_name \u4ece\u7cfb\u7edf\u5220\u9664\u4e00\u4e2adeb\u5305<\/p>\n<p>apt-get check \u786e\u8ba4\u4f9d\u8d56\u7684\u8f6f\u4ef6\u4ed3\u5e93\u6b63\u786e<\/p>\n<p>apt-get clean \u4ece\u4e0b\u8f7d\u7684\u8f6f\u4ef6\u5305\u4e2d\u6e05\u7406\u7f13\u5b58<\/p>\n<p>apt-cache search searched-package \u8fd4\u56de\u5305\u542b\u6240\u8981\u641c\u7d22\u5b57\u7b26\u4e32\u7684\u8f6f\u4ef6\u5305\u540d\u79f0<\/p>\n<p>\u770b\u6587\u4ef6\u5185\u5bb9<\/p>\n<p>cat file1 \u4ece\u7b2c\u4e00\u4e2a\u5b57\u8282\u5f00\u59cb\u6b63\u5411\u67e5\u770b\u6587\u4ef6\u7684\u5185\u5bb9<\/p>\n<p>tac file1 \u4ece\u6700\u540e\u4e00\u884c\u5f00\u59cb\u53cd\u5411\u67e5\u770b\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9<\/p>\n<p>more file1 \u67e5\u770b\u4e00\u4e2a\u957f\u6587\u4ef6\u7684\u5185\u5bb9<\/p>\n<p>less file1 \u7c7b\u4f3c\u4e8e &#8216;more&#8217; \u547d\u4ee4\uff0c\u4f46\u662f\u5b83\u5141\u8bb8\u5728\u6587\u4ef6\u4e2d\u548c\u6b63\u5411\u64cd\u4f5c\u4e00\u6837\u7684\u53cd\u5411\u64cd\u4f5c<\/p>\n<p>head -2 file1 \u67e5\u770b\u4e00\u4e2a\u6587\u4ef6\u7684\u524d\u4e24\u884c<\/p>\n<p>tail -2 file1 \u67e5\u770b\u4e00\u4e2a\u6587\u4ef6\u7684\u6700\u540e\u4e24\u884c<\/p>\n<p>tail -f \/var\/log\/messages \u5b9e\u65f6\u67e5\u770b\u88ab\u6dfb\u52a0\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9<\/p>\n<p>\u6587\u672c\u5904\u7406<\/p>\n<p>cat file1 file2 &#8230; | command &lt;&gt; file1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and STDOUT<\/p>\n<p>cat file1 | command( sed, grep, awk, grep, etc&#8230;) &gt; result.txt \u5408\u5e76\u4e00\u4e2a\u6587\u4ef6\u7684\u8be6\u7ec6\u8bf4\u660e\u6587\u672c\uff0c\u5e76\u5c06\u7b80\u4ecb\u5199\u5165\u4e00\u4e2a\u65b0\u6587\u4ef6\u4e2d<\/p>\n<p>cat file1 | command( sed, grep, awk, grep, etc&#8230;) &gt;&gt; result.txt \u5408\u5e76\u4e00\u4e2a\u6587\u4ef6\u7684\u8be6\u7ec6\u8bf4\u660e\u6587\u672c\uff0c\u5e76\u5c06\u7b80\u4ecb\u5199\u5165\u4e00\u4e2a\u5df2\u6709\u7684\u6587\u4ef6\u4e2d<\/p>\n<p>grep Aug \/var\/log\/messages \u5728\u6587\u4ef6 &#8216;\/var\/log\/messages&#8217;\u4e2d\u67e5\u627e\u5173\u952e\u8bcd&#8221;Aug&#8221;<\/p>\n<p>grep ^Aug \/var\/log\/messages \u5728\u6587\u4ef6 &#8216;\/var\/log\/messages&#8217;\u4e2d\u67e5\u627e\u4ee5&#8221;Aug&#8221;\u5f00\u59cb\u7684\u8bcd\u6c47<\/p>\n<p>grep [0-9] \/var\/log\/messages \u9009\u62e9 &#8216;\/var\/log\/messages&#8217; \u6587\u4ef6\u4e2d\u6240\u6709\u5305\u542b\u6570\u5b57\u7684\u884c<\/p>\n<p>grep Aug -R \/var\/log\/* \u5728\u76ee\u5f55 &#8216;\/var\/log&#8217; \u53ca\u968f\u540e\u7684\u76ee\u5f55\u4e2d\u641c\u7d22\u5b57\u7b26\u4e32&#8221;Aug&#8221;<\/p>\n<p>sed &#8216;s\/stringa1\/stringa2\/g&#8217; example.txt \u5c06example.txt\u6587\u4ef6\u4e2d\u7684 &#8220;string1&#8221; \u66ff\u6362\u6210 &#8220;string2&#8221;<\/p>\n<p>sed &#8216;\/^$\/d&#8217; example.txt \u4eceexample.txt\u6587\u4ef6\u4e2d\u5220\u9664\u6240\u6709\u7a7a\u767d\u884c<\/p>\n<p>sed &#8216;\/ *#\/d; \/^$\/d&#8217; example.txt \u4eceexample.txt\u6587\u4ef6\u4e2d\u5220\u9664\u6240\u6709\u6ce8\u91ca\u548c\u7a7a\u767d\u884c<\/p>\n<p>echo &#8216;esempio&#8217; | tr &#8216;[:lower:]&#8217; &#8216;[:upper:]&#8217; \u5408\u5e76\u4e0a\u4e0b\u5355\u5143\u683c\u5185\u5bb9<\/p>\n<p>sed -e &#8216;1d&#8217; result.txt \u4ece\u6587\u4ef6example.txt \u4e2d\u6392\u9664\u7b2c\u4e00\u884c<\/p>\n<p>sed -n &#8216;\/stringa1\/p&#8217; \u67e5\u770b\u53ea\u5305\u542b\u8bcd\u6c47 &#8220;string1&#8243;\u7684\u884c<\/p>\n<p>sed -e &#8216;s\/ *$\/\/&#8217; example.txt \u5220\u9664\u6bcf\u4e00\u884c\u6700\u540e\u7684\u7a7a\u767d\u5b57\u7b26<\/p>\n<p>sed -e &#8216;s\/stringa1\/\/g&#8217; example.txt \u4ece\u6587\u6863\u4e2d\u53ea\u5220\u9664\u8bcd\u6c47 &#8220;string1&#8221; \u5e76\u4fdd\u7559\u5269\u4f59\u5168\u90e8<\/p>\n<p>sed -n &#8216;1,5p;5q&#8217; example.txt \u67e5\u770b\u4ece\u7b2c\u4e00\u884c\u5230\u7b2c5\u884c\u5185\u5bb9<\/p>\n<p>sed -n &#8216;5p;5q&#8217; example.txt \u67e5\u770b\u7b2c5\u884c<\/p>\n<p>sed -e &#8216;s\/00*\/0\/g&#8217; example.txt \u7528\u5355\u4e2a\u96f6\u66ff\u6362\u591a\u4e2a\u96f6<\/p>\n<p>cat -n file1 \u6807\u793a\u6587\u4ef6\u7684\u884c\u6570<\/p>\n<p>cat example.txt | awk &#8216;NR%2==1&#8217; \u5220\u9664example.txt\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u5076\u6570\u884c<\/p>\n<p>echo a b c | awk &#8216;{print $1}&#8217; \u67e5\u770b\u4e00\u884c\u7b2c\u4e00\u680f<\/p>\n<p>echo a b c | awk &#8216;{print $1,$3}&#8217; \u67e5\u770b\u4e00\u884c\u7684\u7b2c\u4e00\u548c\u7b2c\u4e09\u680f<\/p>\n<p>paste file1 file2 \u5408\u5e76\u4e24\u4e2a\u6587\u4ef6\u6216\u4e24\u680f\u7684\u5185\u5bb9<\/p>\n<p>paste -d &#8216;+&#8217; file1 file2 \u5408\u5e76\u4e24\u4e2a\u6587\u4ef6\u6216\u4e24\u680f\u7684\u5185\u5bb9\uff0c\u4e2d\u95f4\u7528&#8221;+&#8221;\u533a\u5206<\/p>\n<p>sort file1 file2 \u6392\u5e8f\u4e24\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9<\/p>\n<p>sort file1 file2 | uniq \u53d6\u51fa\u4e24\u4e2a\u6587\u4ef6\u7684\u5e76\u96c6(\u91cd\u590d\u7684\u884c\u53ea\u4fdd\u7559\u4e00\u4efd)<\/p>\n<p>sort file1 file2 | uniq -u \u5220\u9664\u4ea4\u96c6\uff0c\u7559\u4e0b\u5176\u4ed6\u7684\u884c<\/p>\n<p>sort file1 file2 | uniq -d \u53d6\u51fa\u4e24\u4e2a\u6587\u4ef6\u7684\u4ea4\u96c6(\u53ea\u7559\u4e0b\u540c\u65f6\u5b58\u5728\u4e8e\u4e24\u4e2a\u6587\u4ef6\u4e2d\u7684\u6587\u4ef6)<\/p>\n<p>comm -1 file1 file2 \u6bd4\u8f83\u4e24\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u53ea\u5220\u9664 &#8216;file1&#8217; \u6240\u5305\u542b\u7684\u5185\u5bb9<\/p>\n<p>comm -2 file1 file2 \u6bd4\u8f83\u4e24\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u53ea\u5220\u9664 &#8216;file2&#8217; \u6240\u5305\u542b\u7684\u5185\u5bb9<\/p>\n<p>comm -3 file1 file2 \u6bd4\u8f83\u4e24\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u53ea\u5220\u9664\u4e24\u4e2a\u6587\u4ef6\u5171\u6709\u7684\u90e8\u5206<\/p>\n<p>\u5b57\u7b26\u8bbe\u7f6e\u548c\u6587\u4ef6\u683c\u5f0f\u8f6c\u6362<\/p>\n<p>dos2unix filedos.txt fileunix.txt \u5c06\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\u7684\u683c\u5f0f\u4eceMSDOS\u8f6c\u6362\u6210UNIX<\/p>\n<p>unix2dos fileunix.txt filedos.txt \u5c06\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\u7684\u683c\u5f0f\u4eceUNIX\u8f6c\u6362\u6210MSDOS<\/p>\n<p>recode ..HTML &lt; page.txt &gt; page.html \u5c06\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\u8f6c\u6362\u6210html<\/p>\n<p>recode -l | more \u663e\u793a\u6240\u6709\u5141\u8bb8\u7684\u8f6c\u6362\u683c\u5f0f<\/p>\n<p>\u6587\u4ef6\u7cfb\u7edf\u5206\u6790<\/p>\n<p>badblocks -v \/dev\/hda1 \u68c0\u67e5\u78c1\u76d8hda1\u4e0a\u7684\u574f\u78c1\u5757<\/p>\n<p>fsck \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0alinux\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>fsck.ext2 \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0aext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>e2fsck \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0aext2\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>e2fsck -j \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0aext3\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>fsck.ext3 \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0aext3\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>fsck.vfat \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0afat\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>fsck.msdos \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0ados\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>dosfsck \/dev\/hda1 \u4fee\u590d\/\u68c0\u67e5hda1\u78c1\u76d8\u4e0ados\u6587\u4ef6\u7cfb\u7edf\u7684\u5b8c\u6574\u6027<\/p>\n<p>\u521d\u59cb\u5316\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mkfs \/dev\/hda1 \u5728hda1\u5206\u533a\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mke2fs \/dev\/hda1 \u5728hda1\u5206\u533a\u521b\u5efa\u4e00\u4e2alinux ext2\u7684\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mke2fs -j \/dev\/hda1 \u5728hda1\u5206\u533a\u521b\u5efa\u4e00\u4e2alinux ext3(\u65e5\u5fd7\u578b)\u7684\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mkfs -t vfat 32 -F \/dev\/hda1 \u521b\u5efa\u4e00\u4e2a FAT32 \u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>fdformat -n \/dev\/fd0 \u683c\u5f0f\u5316\u4e00\u4e2a\u8f6f\u76d8<\/p>\n<p>mkswap \/dev\/hda3 \u521b\u5efa\u4e00\u4e2aswap\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>SWAP\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>mkswap \/dev\/hda3 \u521b\u5efa\u4e00\u4e2aswap\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>swapon \/dev\/hda3 \u542f\u7528\u4e00\u4e2a\u65b0\u7684swap\u6587\u4ef6\u7cfb\u7edf<\/p>\n<p>swapon \/dev\/hda2 \/dev\/hdb3 \u542f\u7528\u4e24\u4e2aswap\u5206\u533a<\/p>\n<p>\u5907\u4efd<\/p>\n<p>dump -0aj -f \/tmp\/home0.bak \/home \u5236\u4f5c\u4e00\u4e2a &#8216;\/home&#8217; \u76ee\u5f55\u7684\u5b8c\u6574\u5907\u4efd<\/p>\n<p>dump -1aj -f \/tmp\/home0.bak \/home \u5236\u4f5c\u4e00\u4e2a &#8216;\/home&#8217; \u76ee\u5f55\u7684\u4ea4\u4e92\u5f0f\u5907\u4efd<\/p>\n<p>restore -if \/tmp\/home0.bak \u8fd8\u539f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u5907\u4efd<\/p>\n<p>rsync -rogpav &#8211;delete \/home \/tmp \u540c\u6b65\u4e24\u8fb9\u7684\u76ee\u5f55<\/p>\n<p>rsync -rogpav -e ssh &#8211;delete \/home ip_address:\/tmp \u901a\u8fc7SSH\u901a\u9053rsync<\/p>\n<p>rsync -az -e ssh &#8211;delete ip_addr:\/home\/public \/home\/local \u901a\u8fc7ssh\u548c\u538b\u7f29\u5c06\u4e00\u4e2a\u8fdc\u7a0b\u76ee\u5f55\u540c\u6b65\u5230\u672c\u5730\u76ee\u5f55<\/p>\n<p>rsync -az -e ssh &#8211;delete \/home\/local ip_addr:\/home\/public \u901a\u8fc7ssh\u548c\u538b\u7f29\u5c06\u672c\u5730\u76ee\u5f55\u540c\u6b65\u5230\u8fdc\u7a0b\u76ee\u5f55<\/p>\n<p>dd bs=1M if=\/dev\/hda | gzip | ssh user@ip_addr &#8216;dd of=hda.gz&#8217; \u901a\u8fc7ssh\u5728\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u6267\u884c\u4e00\u6b21\u5907\u4efd\u672c\u5730\u78c1\u76d8\u7684\u64cd\u4f5c<\/p>\n<p>dd if=\/dev\/sda of=\/tmp\/file1 \u5907\u4efd\u78c1\u76d8\u5185\u5bb9\u5230\u4e00\u4e2a\u6587\u4ef6<\/p>\n<p>tar -Puf backup.tar \/home\/user \u6267\u884c\u4e00\u6b21\u5bf9 &#8216;\/home\/user&#8217; \u76ee\u5f55\u7684\u4ea4\u4e92\u5f0f\u5907\u4efd\u64cd\u4f5c<\/p>\n<p>( cd \/tmp\/local\/ &amp;&amp; tar c . ) | ssh -C user@ip_addr &#8216;cd \/home\/share\/ &amp;&amp; tar x -p&#8217; \u901a\u8fc7ssh\u5728\u8fdc\u7a0b\u76ee\u5f55\u4e2d\u590d\u5236\u4e00\u4e2a\u76ee\u5f55\u5185\u5bb9<\/p>\n<p>( tar c \/home ) | ssh -C user@ip_addr &#8216;cd \/home\/backup-home &amp;&amp; tar x -p&#8217; \u901a\u8fc7ssh\u5728\u8fdc\u7a0b\u76ee\u5f55\u4e2d\u590d\u5236\u4e00\u4e2a\u672c\u5730\u76ee\u5f55<\/p>\n<p>tar cf &#8211; . | (cd \/tmp\/backup ; tar xf &#8211; ) \u672c\u5730\u5c06\u4e00\u4e2a\u76ee\u5f55\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5730\u65b9\uff0c\u4fdd\u7559\u539f\u6709\u6743\u9650\u53ca\u94fe\u63a5<\/p>\n<p>find \/home\/user1 -name &#8216;*.txt&#8217; | xargs cp -av &#8211;target-directory=\/home\/backup\/ &#8211;parents \u4ece\u4e00\u4e2a\u76ee\u5f55\u67e5\u627e\u5e76\u590d\u5236\u6240\u6709\u4ee5 &#8216;.txt&#8217; \u7ed3\u5c3e\u7684\u6587\u4ef6\u5230\u53e6\u4e00\u4e2a\u76ee\u5f55<\/p>\n<p>find \/var\/log -name &#8216;*.log&#8217; | tar cv &#8211;files-from=- | bzip2 &gt; log.tar.bz2 \u67e5\u627e\u6240\u6709\u4ee5 &#8216;.log&#8217; \u7ed3\u5c3e\u7684\u6587\u4ef6\u5e76\u505a\u6210\u4e00\u4e2abzip\u5305<\/p>\n<p>dd if=\/dev\/hda of=\/dev\/fd0 bs=512 count=1 \u505a\u4e00\u4e2a\u5c06 MBR (Master Boot Record)\u5185\u5bb9\u590d\u5236\u5230\u8f6f\u76d8\u7684\u52a8\u4f5c<\/p>\n<p>dd if=\/dev\/fd0 of=\/dev\/hda bs=512 count=1 \u4ece\u5df2\u7ecf\u4fdd\u5b58\u5230\u8f6f\u76d8\u7684\u5907\u4efd\u4e2d\u6062\u590dMBR\u5185\u5bb9<\/p>\n<p>\u5149\u76d8<\/p>\n<p>cdrecord -v gracetime=2 dev=\/dev\/cdrom -eject blank=fast -force \u6e05\u7a7a\u4e00\u4e2a\u53ef\u590d\u5199\u7684\u5149\u76d8\u5185\u5bb9<\/p>\n<p>mkisofs \/dev\/cdrom &gt; cd.iso \u5728\u78c1\u76d8\u4e0a\u521b\u5efa\u4e00\u4e2a\u5149\u76d8\u7684iso\u955c\u50cf\u6587\u4ef6<\/p>\n<p>mkisofs \/dev\/cdrom | gzip &gt; cd_iso.gz \u5728\u78c1\u76d8\u4e0a\u521b\u5efa\u4e00\u4e2a\u538b\u7f29\u4e86\u7684\u5149\u76d8iso\u955c\u50cf\u6587\u4ef6<\/p>\n<p>mkisofs -J -allow-leading-dots -R -V &#8220;Label CD&#8221; -iso-level 4 -o .\/cd.iso data_cd \u521b\u5efa\u4e00\u4e2a\u76ee\u5f55\u7684iso\u955c\u50cf\u6587\u4ef6<\/p>\n<p>cdrecord -v dev=\/dev\/cdrom cd.iso \u523b\u5f55\u4e00\u4e2aISO\u955c\u50cf\u6587\u4ef6<\/p>\n<p>gzip -dc cd_iso.gz | cdrecord dev=\/dev\/cdrom &#8211; \u523b\u5f55\u4e00\u4e2a\u538b\u7f29\u4e86\u7684ISO\u955c\u50cf\u6587\u4ef6<\/p>\n<p>mount -o loop cd.iso \/mnt\/iso \u6302\u8f7d\u4e00\u4e2aISO\u955c\u50cf\u6587\u4ef6<\/p>\n<p>cd-paranoia -B \u4ece\u4e00\u4e2aCD\u5149\u76d8\u8f6c\u5f55\u97f3\u8f68\u5230 wav \u6587\u4ef6\u4e2d<\/p>\n<p>cd-paranoia &#8212; &#8220;-3&#8221; \u4ece\u4e00\u4e2aCD\u5149\u76d8\u8f6c\u5f55\u97f3\u8f68\u5230 wav \u6587\u4ef6\u4e2d\uff08\u53c2\u6570-3\uff09<\/p>\n<p>cdrecord &#8211;scanbus \u626b\u63cf\u603b\u7ebf\u4ee5\u8bc6\u522bscsi\u901a\u9053<\/p>\n<p>dd if=\/dev\/hdc | md5sum \u6821\u9a8c\u4e00\u4e2a\u8bbe\u5907\u7684md5sum\u7f16\u7801\uff0c\u4f8b\u5982\u4e00\u5f20 CD<\/p>\n<p>\u7f51\u7edc &#8211; \uff08\u4ee5\u592a\u7f51\u548cWIFI\u65e0\u7ebf\uff09<\/p>\n<p>ifconfig eth0 \u663e\u793a\u4e00\u4e2a\u4ee5\u592a\u7f51\u5361\u7684\u914d\u7f6e<\/p>\n<p>ifup eth0 \u542f\u7528\u4e00\u4e2a &#8216;eth0&#8217; \u7f51\u7edc\u8bbe\u5907<\/p>\n<p>ifdown eth0 \u7981\u7528\u4e00\u4e2a &#8216;eth0&#8217; \u7f51\u7edc\u8bbe\u5907<\/p>\n<p>ifconfig eth0 192.168.1.1 netmask 255.255.255.0 \u63a7\u5236IP\u5730\u5740<\/p>\n<p>ifconfig eth0 promisc \u8bbe\u7f6e &#8216;eth0&#8217; \u6210\u6df7\u6742\u6a21\u5f0f\u4ee5\u55c5\u63a2\u6570\u636e\u5305 (sniffing)<\/p>\n<p>dhclient eth0 \u4ee5dhcp\u6a21\u5f0f\u542f\u7528 &#8216;eth0&#8217;<\/p>\n<p>route -n show routing table<\/p>\n<p>route add -net 0\/0 gw IP_Gateway configura default gateway<\/p>\n<p>route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 configure static route to reach network &#8216;192.168.0.0\/16&#8217;<\/p>\n<p>route del 0\/0 gw IP_gateway remove static route<\/p>\n<p>echo &#8220;1&#8221; &gt; \/proc\/sys\/net\/ipv4\/ip_forward activate ip routing<\/p>\n<p>hostname show hostname of system<\/p>\n<p>host\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.example.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Example Domain<\/a>\u00a0lookup hostname to resolve name to ip address and viceversa(1)<\/p>\n<p>nslookup\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.example.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Example Domain<\/a>\u00a0lookup hostname to resolve name to ip address and viceversa(2)<\/p>\n<p>ip link show show link status of all interfaces<\/p>\n<p>mii-tool eth0 show link status of &#8216;eth0&#8217;<\/p>\n<p>ethtool eth0 show statistics of network card &#8216;eth0&#8217;<\/p>\n<p>netstat -tup show all active network connections and their PID<\/p>\n<p>netstat -tupl show all network services listening on the system and their PID<\/p>\n<p>tcpdump tcp port 80 show all HTTP traffic<\/p>\n<p>iwlist scan show wireless networks<\/p>\n<p>iwconfig eth1 show configuration of a wireless network card<\/p>\n<p>hostname show hostname<\/p>\n<p>host\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.example.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Example Domain<\/a>\u00a0lookup hostname to resolve name to ip address and viceversa<\/p>\n<p>nslookup\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.example.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Example Domain<\/a>\u00a0lookup hostname to resolve name to ip address and viceversa<\/p>\n<p>whois\u00a0<a class=\" wrap external\" href=\"https:\/\/link.zhihu.com\/?target=http%3A\/\/www.example.com\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-za-detail-view-id=\"1043\">Example Domain<\/a>\u00a0lookup on Whois database<\/p>\n<p>JPS\u5de5\u5177<\/p>\n<p>jps(Java Virtual Machine Process Status Tool)\u662fJDK 1.5\u63d0\u4f9b\u7684\u4e00\u4e2a\u663e\u793a\u5f53\u524d\u6240\u6709java\u8fdb\u7a0bpid\u7684\u547d\u4ee4\uff0c\u7b80\u5355\u5b9e\u7528\uff0c\u975e\u5e38\u9002\u5408\u5728linux\/unix\u5e73\u53f0\u4e0a\u7b80\u5355\u5bdf\u770b\u5f53\u524djava\u8fdb\u7a0b\u7684\u4e00\u4e9b\u7b80\u5355\u60c5\u51b5\u3002<\/p>\n<p>\u6211\u60f3\u5f88\u591a\u4eba\u90fd\u662f\u7528\u8fc7unix\u7cfb\u7edf\u91cc\u7684ps\u547d\u4ee4\uff0c\u8fd9\u4e2a\u547d\u4ee4\u4e3b\u8981\u662f\u7528\u6765\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u7684\u8fdb\u7a0b\u60c5\u51b5\uff0c\u6709\u54ea\u4e9b\u8fdb\u7a0b\uff0c\u53ca\u5176 id\u3002 jps \u4e5f\u662f\u4e00\u6837\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u7684java\u8fdb\u7a0b\u60c5\u51b5\uff0c\u53ca\u5176id\u53f7\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5b83\u6765\u67e5\u770b\u6211\u4eec\u5230\u5e95\u542f\u52a8\u4e86\u51e0\u4e2ajava\u8fdb\u7a0b\uff08\u56e0\u4e3a\u6bcf\u4e00\u4e2ajava\u7a0b\u5e8f\u90fd\u4f1a\u72ec\u5360\u4e00\u4e2ajava\u865a\u62df\u673a\u5b9e\u4f8b\uff09\uff0c\u548c\u4ed6\u4eec\u7684\u8fdb\u7a0b\u53f7\uff08\u4e3a\u4e0b\u9762\u51e0\u4e2a\u7a0b\u5e8f\u505a\u51c6\u5907\uff09\uff0c\u5e76\u53ef\u901a\u8fc7opt\u6765\u67e5\u770b\u8fd9\u4e9b\u8fdb\u7a0b\u7684\u8be6\u7ec6\u542f\u52a8\u53c2\u6570\u3002<\/p>\n<p>\u4f7f\u7528\u65b9\u6cd5\uff1a\u5728\u5f53\u524d\u547d\u4ee4\u884c\u4e0b\u6253 jps(\u9700\u8981JAVA_HOME\uff0c\u6ca1\u6709\u7684\u8bdd\uff0c\u5230\u6539\u7a0b\u5e8f\u7684\u76ee\u5f55\u4e0b\u6253) \u3002<\/p>\n<p>jps\u5b58\u653e\u5728JAVA_HOME\/bin\/jps\uff0c\u4f7f\u7528\u65f6\u4e3a\u4e86\u65b9\u4fbf\u8bf7\u5c06JAVA_HOME\/bin\/\u52a0\u5165\u5230Path.<\/p>\n<p>$&gt; jps<\/p>\n<p>23991 Jps<\/p>\n<p>23789 BossMain<\/p>\n<p>23651 Resin<\/p>\n<p>\u6bd4\u8f83\u5e38\u7528\u7684\u53c2\u6570\uff1a<\/p>\n<p>-q \u53ea\u663e\u793apid\uff0c\u4e0d\u663e\u793aclass\u540d\u79f0,jar\u6587\u4ef6\u540d\u548c\u4f20\u9012\u7ed9main \u65b9\u6cd5\u7684\u53c2\u6570<\/p>\n<p>$&gt; jps -q<\/p>\n<p>28680<\/p>\n<p>23789<\/p>\n<p>23651<\/p>\n<p>-m \u8f93\u51fa\u4f20\u9012\u7ed9main \u65b9\u6cd5\u7684\u53c2\u6570\uff0c\u5728\u5d4c\u5165\u5f0fjvm\u4e0a\u53ef\u80fd\u662fnull<\/p>\n<p>$&gt; jps -m<\/p>\n<p>28715 Jps -m<\/p>\n<p>23789 BossMain<\/p>\n<p>23651 Resin -socketwait 32768 -stdout \/data\/aoxj\/resin\/log\/stdout.log -stderr \/data\/aoxj\/resin\/log\/stderr.log<\/p>\n<p>-l \u8f93\u51fa\u5e94\u7528\u7a0b\u5e8fmain class\u7684\u5b8c\u6574package\u540d \u6216\u8005 \u5e94\u7528\u7a0b\u5e8f\u7684jar\u6587\u4ef6\u5b8c\u6574\u8def\u5f84\u540d<\/p>\n<p>$&gt; jps -l<\/p>\n<p>28729 sun.tools.jps.Jps<\/p>\n<p>23789 com.asiainfo.aimc.bossbi.BossMain<\/p>\n<p>23651 com.caucho.server.resin.Resin<\/p>\n<p>-v \u8f93\u51fa\u4f20\u9012\u7ed9JVM\u7684\u53c2\u6570<\/p>\n<p>$&gt; jps -v<\/p>\n<p>23789 BossMain<\/p>\n<p>28802 Jps -Denv.class.path=\/data\/aoxj\/bossbi\/twsecurity\/java\/trustwork140.jar:\/data\/aoxj\/bossbi\/twsecurity\/java\/:\/data\/aoxj\/bossbi\/twsecurity\/java\/twcmcc.jar:\/data\/aoxj\/jdk15\/lib\/rt.jar:\/data\/aoxj\/jd<\/p>\n<p>k15\/lib\/tools.jar -Dapplication.home=\/data\/aoxj\/jdk15 -Xms8m<\/p>\n<p>23651 Resin -Xss1m -Dresin.home=\/data\/aoxj\/resin -Dserver.root=\/data\/aoxj\/resin -Djava.util.logging.manager=com.caucho.log.LogManagerImpl &#8211;<\/p>\n<p>Djavax.management.builder.initial=com.caucho.jmx.MBeanServerBuilderImpl<\/p>\n<p>sudo jps\u770b\u5230\u7684\u8fdb\u7a0b\u6570\u91cf\u6700\u5168<\/p>\n<p>jps 192.168.0.77<\/p>\n<p>\u5217\u51fa\u8fdc\u7a0b\u670d\u52a1\u5668192.168.0.77\u673a\u5668\u6240\u6709\u7684jvm\u5b9e\u4f8b\uff0c\u91c7\u7528rmi\u534f\u8bae\uff0c\u9ed8\u8ba4\u8fde\u63a5\u7aef\u53e3\u4e3a1099<\/p>\n<p>\uff08\u524d\u63d0\u662f\u8fdc\u7a0b\u670d\u52a1\u5668\u63d0\u4f9bjstatd\u670d\u52a1\uff09<\/p>\n<p>\u6ce8\uff1ajps\u547d\u4ee4\u6709\u4e2a\u5730\u65b9\u5f88\u4e0d\u597d\uff0c\u4f3c\u4e4e\u53ea\u80fd\u663e\u793a\u5f53\u524d\u7528\u6237\u7684java\u8fdb\u7a0b\uff0c\u8981\u663e\u793a\u5176\u4ed6\u7528\u6237\u7684\u8fd8\u662f\u53ea\u80fd\u7528unix\/linux\u7684ps\u547d\u4ee4\u3002<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 \u7aef\u53e3\u76d1\u542c\u67e5\u770b\uff1a ss -tln<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-3578","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=3578"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3578\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=3578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=3578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=3578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}