{"id":261958,"date":"2023-02-20T08:35:36","date_gmt":"2023-02-20T00:35:36","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=261958"},"modified":"2023-01-19T11:37:45","modified_gmt":"2023-01-19T03:37:45","slug":"w-command-usecase","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/w-command-usecase.html","title":{"rendered":"w \u547d\u4ee4\u7684\u89e3\u91ca\u4e0e\u793a\u4f8b"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4e0b\u9762\u662f\u4e00\u4efd\u5173\u4e8e\u7406\u89e3 Linux \u548c BSD \u4e2d\u7684 w \u547d\u4ee4\u7684\u521d\u5b66\u8005\u6307\u5357\uff0c\u5e76\u9644\u6709\u51e0\u4e2a\u4f8b\u5b50\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\" <\/p>\n

\u8fd9\u7bc7\u6587\u7ae0\u662f \u200b\u200bLinux \u547d\u4ee4\u200b\u200b\u5b66\u4e60\u7cfb\u5217\u7684\u4e00\u90e8\u5206\u3002<\/p>\n

w \u547d\u4ee4<\/strong><\/div>\n

\u200b\u200bw\u200b\u200b \u547d\u4ee4\u662f Linux \u4e2d\u7684\u4e00\u4e2a\u5de5\u5177\uff0c\u5b83\u663e\u793a\u5f53\u524d\u767b\u5f55\u5230\u7cfb\u7edf\u4e2d\u7684\u7528\u6237\u53ca\u5176\u8fdb\u7a0b\u7684\u4fe1\u606f\u3002\u5b83\u663e\u793a\u8c01\u5df2\u767b\u5f55\uff0c\u4ee5\u53ca\u4ed6\u4eec\u6b63\u5728\u505a\u4ec0\u4e48\u6d3b\u52a8\u3002\u8fd9\u610f\u5473\u7740\u5b83\u53ef\u4ee5\u663e\u793a\u4ed6\u4eec\u5728\u7cfb\u7edf\u4e2d\u8fd0\u884c\u4ec0\u4e48\u8fdb\u7a0b\u3002<\/p>\n

\u8bed\u6cd5<\/strong><\/div>\n

\u4e0b\u9762\u662f \u200b\u200bw\u200b\u200b \u547d\u4ee4\u7684\u57fa\u672c\u8bed\u6cd5\uff1a<\/p>\n

w [options] [username]<\/pre>\n

\u200b\u200bw\u200b\u200b\u200b \u547d\u4ee4\u63a5\u53d7\u4e00\u4e2a\u53ef\u9009\u7684\u9009\u9879\u5217\u8868\uff0c\u7136\u540e\u662f\u4e00\u4e2a\u53ef\u9009\u7684\u7528\u6237\u540d\u3002\u5982\u679c\u6307\u5b9a\u4e86\u7528\u6237\u540d\uff0c\u200b\u200bw\u200b\u200b \u5c06\u53ea\u663e\u793a\u8be5\u7528\u6237\u62e5\u6709\u7684\u8fdb\u7a0b\u4fe1\u606f\u3002<\/p>\n

w \u547d\u4ee4\u7684\u4f8b\u5b50\u53ca\u5176\u7528\u6cd5<\/strong><\/div>\n

\u4e0b\u9762\u662f\u4e00\u4e9b\u4f7f\u7528 \u200b\u200bw\u200b\u200b \u547d\u4ee4\u7684\u4f8b\u5b50\u3002<\/p>\n

\u5f53\u4f60\u53ea\u7528 \u200b\u200bw\u200b\u200b \u8fd0\u884c\u5b83\u65f6\uff0c\u5b83\u663e\u793a\u4ee5\u4e0b\u8f93\u51fa\uff1a<\/p>\n

\r\n$ w 21:45:07 up 1 day, 12:48,  1 user,  load average: 1.05, 0.85, 0.56USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHATdebugpoi tty2       Thu08   36:48m  0.03s  0.03s \/usr\/libexec\/gnome-session-binary\r\n<\/pre>\n

\"\"<\/p>\n

\u89e3\u91ca\uff1a\u200b\u200bUSER\u200b\u200b \u5217\u7ed9\u51fa\u4e86\u7528\u6237\u540d\uff0c\u7136\u540e\u662f\u7ec8\u7aef\u53f7\u3001\u767b\u5f55\u65e5\u671f\u65f6\u95f4\u3001\u7a7a\u95f2\u65f6\u95f4\u3001CPU \u4f7f\u7528\u7387\uff0c\u4ee5\u53ca\u7528\u6237\u6b63\u5728\u6267\u884c\u7684\u8fdb\u7a0b\u3002<\/p>\n

  • \u200b\u200bUSER\u200b\u200b - \u5728\u4f60\u7684 Linux \u6216 BSD \u7cfb\u7edf\u4e2d\u767b\u5f55\u7684\u7528\u6237\u540d\u79f0\u3002<\/li>\n
  • \u200b\u200bTTY\u200b\u200b - \u5f53\u524d\u4f1a\u8bdd\u7684\u7ec8\u7aef\u6807\u8bc6\u7b26\u53f7\u3002<\/li>\n
  • \u200b\u200bFROM\u200b\u200b - \u7528\u6237\u7684\u4e3b\u673a\u540d\u6216 IP \u5730\u5740\u3002<\/li>\n
  • \u200b\u200bLOGIN@\u200b\u200b - \u7528\u6237\u767b\u5f55\u7684\u65f6\u95f4\u3002\u5b83\u6709\u65f6\u4f1a\u6839\u636e\u4f60\u7684\u7cfb\u7edf\u8bbe\u7f6e\u663e\u793a\u65e5\u671f\u3002<\/li>\n
  • \u200b\u200bIDLE\u200b\u200b - \u7528\u6237\u4e0e\u7ec8\u7aef\u4ea4\u4e92\u540e\u7684\u7a7a\u95f2\u65f6\u95f4\u3002<\/li>\n
  • \u200b\u200bJCPU\u200b\u200b - \u8be5\u4f1a\u8bdd\u7684\u6240\u6709\u7528\u6237\u8fdb\u7a0b\u4f7f\u7528\u7684 CPU \u65f6\u95f4\u3002<\/li>\n
  • \u200b\u200bPCPU\u200b\u200b\u200b - \u8be5\u7528\u6237\u7684\u8fdb\u7a0b\uff08\u5728\u200b\u200bWHAT\u200b\u200b \u5b57\u6bb5\u4e2d\u63d0\u5230\uff09\u4f7f\u7528\u7684\u65f6\u95f4\u3002<\/li>\n
  • \u200b\u200bWHAT\u200b\u200b - \u5f53\u524d\u5e26\u53c2\u6570\u7684\u8fdb\u7a0b\u3002<\/li>\n

    \u4e0b\u9762\u662f \u200b\u200bw\u200b\u200b \u547d\u4ee4\u7684\u53e6\u4e00\u4e2a\u4f8b\u5b50\uff0c\u6709\u4e24\u4e2a\u7528\u6237\u5728\u865a\u62df\u673a\u73af\u5883\u4e2d\u767b\u5f55\u3002\u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\uff0c\u663e\u793a\u4e86\u4e24\u4e2a\u7528\u6237\u540d\u4e0e\u5f53\u524d\u8fd0\u884c\u7684\u5e26\u6709\u8fdb\u7a0b\u53c2\u6570\u7684\u72ec\u7acb\u8fdb\u7a0b\u3002<\/p>\n

    \"\"<\/p>\n

    \u8ba9\u6211\u4eec\u770b\u4e00\u4e0b\u8fd9\u4e2a\u547d\u4ee4\u7684\u4e00\u4e9b\u9009\u9879\u3002<\/p>\n

    \u8981\u505c\u6b62\u663e\u793a\u6807\u9898\uff0c\u4f7f\u7528 \u200b\u200b-h\u200b\u200b\u200b \u9009\u9879\u3002\u5b83\u4e0e \u200b\u200b--no-header\u200b\u200b \u5f00\u5173\u76f8\u540c\u3002<\/p>\n

    $ w -h<\/pre>\n

    \u200b\u200b-f\u200b\u200b\u200b \u9009\u9879\u53ef\u4ee5\u5728\u8f93\u51fa\u4e2d\u5207\u6362 \u200b\u200bFROM\u200b\u200b \u5b57\u6bb5\u7684\u53ef\u89c1\u6027\u3002<\/p>\n

    $ w -f<\/pre>\n

    \u4f7f\u7528 \u200b\u200b-s\u200b\u200b\u200b \u9009\u9879\u6253\u5370\u4e00\u4e2a\u7b80\u77ed\u7684\u8f93\u51fa\uff0c\u4e0d\u5305\u62ec \u200b\u200bJCPU\u200b\u200b\u200b\u3001\u200b\u200bPCPU\u200b\u200b\u200b \u548c \u200b\u200bLOGIN@\u200b\u200b \u4fe1\u606f\u3002<\/p>\n

    $ w -s<\/pre>\n

    \u8981\u663e\u793a\u4e00\u4e2a\u7279\u5b9a\u7528\u6237\uff08\u4f8b\u5982\uff0c\u200b\u200bdebugpoint\u200b\u200b\uff09\u62e5\u6709\u7684\u6240\u6709\u8fdb\u7a0b\u7684\u5217\u8868\uff1a<\/p>\n

    $ w debugpoint<\/pre>\n
    \u7ed3\u675f\u8bed<\/strong><\/div>\n

    \u6211\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u4f60\u4e86\u89e3 \u200b\u200bw\u200b\u200b\u200b \u547d\u4ee4\u53ca\u5176\u57fa\u672c\u539f\u7406\u3002\u4f60\u4e5f\u53ef\u4ee5\u9605\u8bfb \u200b\u200bw \u624b\u518c\u9875\u200b\u200b \u6765\u4e86\u89e3\u66f4\u591a\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u8bf7\u544a\u8bc9\u6211\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

    \u8fd9\u7bc7\u6587\u7ae0\u662f \u200b\u200bLinux \u547d\u4ee4\u200b\u200b\u5b66\u4e60\u7cfb\u5217\u7684\u4e00\u90e8\u5206\u3002 \u200b\u200bw\u200b\u200b \u547d\u4ee4\u662f Linux \u4e2d\u7684\u4e00\u4e2a\u5de5\u5177\uff0c\u5b83\u663e\u793a\u5f53 […]<\/p>\n","protected":false},"author":317,"featured_media":259566,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-261958","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/261958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/317"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=261958"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/261958\/revisions"}],"predecessor-version":[{"id":261969,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/261958\/revisions\/261969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/259566"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=261958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=261958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=261958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}