{"id":261459,"date":"2023-02-05T10:41:04","date_gmt":"2023-02-05T02:41:04","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=261459"},"modified":"2023-01-30T11:42:05","modified_gmt":"2023-01-30T03:42:05","slug":"command-for-beginners","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/command-for-beginners.html","title":{"rendered":"\u9002\u5408\u521d\u5b66\u8005\u7684who \u547d\u4ee4\u7684\u89e3\u91ca\u4e0e\u793a\u4f8b\u6307\u5357"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u91cc\u662f\u4e00\u4e2a\u5173\u4e8e\u7406\u89e3 Linux \u4e2d who \u547d\u4ee4\u7684\u521d\u5b66\u8005\u6307\u5357\uff0c\u5e76\u5e26\u6709\u51e0\u4e2a\u4f8b\u5b50\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

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

Linux \u4e2d\u7684 who \u547d\u4ee4\u7528\u4e8e\u663e\u793a\u5f53\u524d\u767b\u5f55\u5230\u7cfb\u7edf\u4e2d\u7684\u7528\u6237\u7684\u4fe1\u606f\u3002\u5b83\u663e\u793a\u7528\u6237\u7684\u767b\u5f55\u540d\uff0c\u7528\u6237\u767b\u5f55\u7684\u7ec8\u7aef\uff0c\u7528\u6237\u767b\u5f55\u7684\u65f6\u95f4\uff0c\u4ee5\u53ca\u8fdc\u7a0b\u4e3b\u673a\u540d\uff08\u5982\u679c\u6709\uff09\u3002<\/p>\n

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

who [OPTION]... [ FILE | ARG1 ARG2 ]<\/pre>\n
\u5404\u79cd who \u547d\u4ee4\u548c\u5f00\u5173\u7684\u4f8b\u5b50<\/strong><\/div>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cwho \u8bfb\u53d6\u6587\u4ef6 \/var\/run\/utmp\uff0c\u5176\u4e2d\u5305\u542b\u5f53\u524d\u767b\u5f55\u7684\u7528\u6237\u7684\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u9009\u9879\uff0c\u5b83\u4f1a\u663e\u793a\u6bcf\u4e2a\u7528\u6237\u7684\u767b\u5f55\u540d\u3001\u7ec8\u7aef\u548c\u767b\u5f55\u65f6\u95f4\u3002<\/p>\n

who<\/pre>\n

\u5b83\u7ed9\u51fa\u4e86\u4ee5\u4e0b\u8f93\u51fa\u3002\u4f60\u53ef\u4ee5\u770b\u5230\u5b83\u663e\u793a\u4e86\u767b\u5f55\u540d\u662f debugpoint\uff0c\u7ec8\u7aef ID tty2 \u548c\u767b\u5f55\u7684\u65e5\u671f\u548c\u65f6\u95f4\u3002<\/p>\n

debugpoint tty2 2023-01-01 11:22 (tty2)<\/pre>\n

\"\"<\/p>\n

who \u547d\u4ee4 \u2013 \u9ed8\u8ba4\u793a\u4f8b<\/strong><\/span><\/div>\n

\u7136\u800c\uff0c\u5982\u679c\u4f60\u5728\u865a\u62df\u673a\u4e2d\u8fd0\u884c\u4e0a\u8ff0\u547d\u4ee4\uff0c\u4f60\u5e94\u8be5\u770b\u5230\u540c\u6837\u7684\u60c5\u51b5\uff0c\u4f46\u7ec8\u7aef ID \u5c06\u662f x11 \u670d\u52a1\u5668\u7684\u663e\u793a\u540d\u79f0\uff0c\u5373 :0\u3002<\/p>\n

\u276f who\r\ndebugpoint :0 2023-01-01 23:36 (:0)<\/pre>\n

\u8981\u663e\u793a\u5f53\u524d\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u4fe1\u606f\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\uff1a<\/p>\n

whoami<\/pre>\n

\u4f7f\u7528 -b \u9009\u9879\u67e5\u770b\u6700\u540e\u4e00\u6b21\u7cfb\u7edf\u542f\u52a8\u65f6\u95f4\uff1a<\/p>\n

\u276f who -b\r\nsystem boot 2023-01-01 23:36<\/pre>\n

\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u4e2d\u767b\u5f55\u7684\u7528\u6237\u6570\uff1a<\/p>\n

\u276f who -q\r\ndebugpoint\r\nusers=1<\/pre>\n

\u6240\u6709\u4e0a\u8ff0\u547d\u4ee4\u4e0e -H \u9009\u9879\u914d\u5bf9\u65f6\uff0c\u4f60\u4f1a\u6709\u4e00\u4e2a\u66f4\u597d\u7684\u542b\u6807\u9898\u884c\u7684\u4fe1\u606f\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

who -H\r\nNAME LINE TIME COMMENT\r\ndebugpoint tty2 2023-01-01 11:22 (tty2)<\/pre>\n

\u5982\u679c\u4f60\u60f3\u5728 Linux \u4e2d\u663e\u793a\u4e0e who \u547d\u4ee4\u6709\u5173\u7684\u6240\u6709\u4fe1\u606f\uff0c\u8bf7\u4f7f\u7528\u9009\u9879 -a\uff1a<\/p>\n

who -aH\r\nNAME LINE TIME IDLE PID COMMENT EXIT\r\nsystem boot 2023-01-01 11:19\r\nrun-level 5 2023-01-01 11:19\r\ndebugpoint + tty2 2023-01-01 11:22 13:26 2042 (tty2)<\/pre>\n

\u50cf\u5f80\u5e38\u4e00\u6837\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u91cd\u5b9a\u5411\u5c06 who \u547d\u4ee4\u7684\u8f93\u51fa\u4fdd\u5b58\u5230\u4efb\u4f55\u6587\u4ef6\uff1a<\/p>\n

who > user_details.txt<\/pre>\n
who \u547d\u4ee4\u9009\u9879\u7684\u4f8b\u5b50\u603b\u7ed3<\/strong><\/span><\/div>\n

\u4e0b\u9762\u662f\u4e00\u4e9b who \u547d\u4ee4\u7684\u4f8b\u5b50\u548c\u5b83\u4eec\u7684\u89e3\u91ca\uff1a<\/p>\n

\u4e0b\u9762\u662f\u4e00\u4e9b\u53ef\u4ee5\u4e0e who \u547d\u4ee4\u4e00\u8d77\u4f7f\u7528\u7684\u9009\u9879\uff1a<\/p>\n

    \n
  1. -a: \u663e\u793a\u6bcf\u4e2a\u7528\u6237\u7684\u4e3b\u673a\u540d\u3001\u767b\u5f55\u65f6\u95f4\u548c\u8fdb\u7a0b<\/li>\n
  2. -b: \u663e\u793a\u4e0a\u6b21\u7cfb\u7edf\u542f\u52a8\u7684\u65f6\u95f4<\/li>\n
  3. -d: \u663e\u793a\u6b7b\u8fdb\u7a0b\uff08\u5df2\u7ec8\u6b62\u4f46\u672a\u4ece utmp \u6587\u4ef6\u4e2d\u5220\u9664\u7684\u8fdb\u7a0b\uff09<\/li>\n
  4. -H: \u663e\u793a\u6807\u9898\u884c<\/li>\n
  5. -l: \u663e\u793a\u957f\u683c\u5f0f\u7684\u767b\u5f55\u8fdb\u7a0b<\/li>\n
  6. -m: \u53ea\u663e\u793a\u5728 ARG1 ARG2 \u6307\u5b9a\u7684\u7ec8\u7aef\u4e0a\u767b\u5f55\u7684\u7528\u6237\u7684\u540d\u5b57\u548c\u884c\u3002<\/li>\n
  7. -q: \u663e\u793a\u5df2\u767b\u5f55\u7528\u6237\u7684\u6570\u91cf<\/li>\n
  8. -u: \u663e\u793a\u62e5\u6709\u672a\u8131\u79bb\u8fdb\u7a0b\u7684\u7528\u6237\u7684\u4fe1\u606f<\/li>\n
  9. -w: \u663e\u793a\u5df2\u7ecf\u767b\u5f55\u7684\u7528\u6237\u4fe1\u606f\uff0c\u683c\u5f0f\u4e0e utmp \u6587\u4ef6\u76f8\u540c<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"

    Linux \u4e2d\u7684 who \u547d\u4ee4\u7528\u4e8e\u663e\u793a\u5f53\u524d\u767b\u5f55\u5230\u7cfb\u7edf\u4e2d\u7684\u7528\u6237\u7684\u4fe1\u606f\u3002\u5b83\u663e\u793a\u7528\u6237\u7684\u767b\u5f55\u540d\uff0c\u7528\u6237\u767b\u5f55\u7684\u7ec8\u7aef\uff0c\u7528\u6237\u767b […]<\/p>\n","protected":false},"author":1481,"featured_media":261463,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-261459","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\/261459","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\/1481"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=261459"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/261459\/revisions"}],"predecessor-version":[{"id":263113,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/261459\/revisions\/263113"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/261463"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=261459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=261459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=261459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}