{"id":1927,"date":"2019-10-03T17:22:02","date_gmt":"2019-10-03T10:22:02","guid":{"rendered":"https:\/\/tino.vn\/?post_type=ht_kb&#038;p=1927"},"modified":"2019-10-05T14:02:09","modified_gmt":"2019-10-05T07:02:09","slug":"cac-tap-lenh-co-ban-cua-thu-muc-proc-trong-linux","status":"publish","type":"ht_kb","link":"https:\/\/tino.vn\/blog\/docs\/cac-tap-lenh-co-ban-cua-thu-muc-proc-trong-linux\/","title":{"rendered":"C\u00e1c t\u1eadp l\u1ec7nh c\u01a1 b\u1ea3n c\u1ee7a th\u01b0 m\u1ee5c \/proc trong linux."},"content":{"rendered":"<p align=\"justify\">C\u00f3 bao gi\u1edd c\u00e1c b\u1ea1n t\u1ef1 h\u1ecfi l\u00e0 nh\u1eefng ch\u01b0\u01a1ng tr\u00ecnh m\u00ecnh hay s\u1eed d\u1ee5ng nh\u01b0 top, ps, free hay KDE System Guard l\u00e0m th\u1ebf n\u00e0o l\u1ea5y \u0111\u01b0\u1ee3c th\u00f4ng tin v\u1ec1 h\u1ec7 th\u1ed1ng nh\u01b0 c\u00e1c process \u0111ang ch\u1ea1y, l\u01b0\u1ee3ng b\u1ed9 nh\u1edb c\u00f2n tr\u1ed1ng, l\u01b0\u1ee3ng CPU \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u2026 hay kh\u00f4ng? C\u00e1c b\u1ea1n \u0111ang h\u1ecdc h\u1ec7 \u0111i\u1ec1u h\u00e0nh, \u0111ang ti\u1ebfp x\u00fac v\u1edbi l\u1eadp tr\u00ecnh h\u1ec7 th\u1ed1ng? V\u00e0 c\u00e1c b\u1ea1n mu\u1ed1n t\u1ef1 m\u00ecnh vi\u1ebft nh\u1eefng ch\u01b0\u01a1ng tr\u00ecnh nh\u01b0 v\u1eady? V\u1eady th\u00ec ki\u1ebfn th\u1ee9c v\u1ec1 h\u1ec7 th\u1ed1ng file \/proc l\u00e0 \u0111i\u1ec1u thi\u1ebft y\u1ebfu c\u00e1c b\u1ea1n c\u1ea7n n\u1eafm. B\u00e0i vi\u1ebft n\u00e0y nh\u1eb1m gi\u1edbi thi\u1ec7u cho c\u00e1c b\u1ea1n c\u00e1c th\u00f4ng tin c\u01a1 b\u1ea3n v\u1ec1 \/proc file system \u0111\u1ec3 d\u1ef1a v\u00e0o \u0111\u00f3 c\u00e1c b\u1ea1n c\u00f3 th\u1ec3 t\u1ef1 b\u1eaft tay v\u00e0o \u201cv\u1ecdc\u201d h\u1ec7 th\u1ed1ng.<\/p>\n<h3 id=\"1._H\u1ec7_th\u1ed1ng_file_\/proc_(_proc_FS)\u00a0\"><span id=\"more-77\"><\/span><span style=\"color: blue;\"><strong>1. H\u1ec7 th\u1ed1ng file \/proc ( proc FS)\u00a0<\/strong><\/span><\/h3>\n<p>Proc l\u00e0 h\u1ec7 th\u1ed1ng file \u1ea3o (pseudo file system), m\u1ed9t h\u1ec7 th\u1ed1ng file th\u1eddi gian th\u1ef1c (real time) v\u00e0 th\u01b0\u1eddng tr\u00fa trong b\u1ed9 nh\u1edb (memory resident) \u0111\u1ec3 theo d\u00f5i c\u00e1c process \u0111ang ch\u1ea1y c\u00f9ng v\u1edbi tr\u1ea1ng th\u00e1i c\u1ee7a h\u1ec7 th\u1ed1ng.<br \/>\nProc l\u00e0 h\u1ec7 th\u1ed1ng file \u1ea3o b\u1edfi v\u00ec tr\u00ean th\u1ef1c t\u1ebf n\u00f3 kh\u00f4ng t\u1ed3n t\u1ea1i trong b\u1ea5t k\u00ec ph\u01b0\u01a1ng ti\u1ec7n l\u01b0u tr\u1eef n\u00e0o. N\u00f3 t\u1ed3n t\u1ea1i d\u1ef1a tr\u00ean b\u1ed9 nh\u1edb \u1ea3o v\u00e0 d\u1eef li\u1ec7u lu\u00f4n thay \u0111\u1ed5i \u0111\u1ed9ng c\u00f9ng v\u1edbi tr\u1ea1gn th\u00e1i c\u1ee7a h\u1ec7 th\u1ed1ng. H\u1ea7u h\u1ebft c\u00e1c d\u1eef li\u1ec7u trong proc FS \u0111\u01b0\u1ee3c c\u1eadp nh\u1eadt li\u00ean t\u1ee5c \u0111\u1ec3 ph\u00f9 h\u1ee3p v\u1edbi tr\u1ea1ng th\u00e1i hi\u1ec7n t\u1ea1i c\u1ee7a h\u1ec7 \u0111i\u1ec1u h\u00e0nh. N\u1ed9i dung c\u1ee7a proc FS c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c \u0111\u1ecdc b\u1edfi user c\u00f3 quy\u1ec1n th\u00edch h\u1ee3p, trong \u0111\u00f3 m\u1ed9t s\u1ed1 ph\u1ea7n ch\u1ec9 d\u00f3 th\u1ec3 \u0111\u1ecdc b\u1edfi owner c\u1ee7a process v\u00e0 root. N\u1ebfu li\u1ec7t k\u00ea th\u01b0 m\u1ee5c root (\/) ra b\u1ea1n s\u1ebd th\u1ea5y<\/p>\n<p>Tr\u00edch:<\/p>\n<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"6\">\n<tbody>\n<tr>\n<td class=\"alt2\"># ls \u2013al \/<br \/>\ndrwxr-xr-x 2 root root 4096 Feb 22 2006 mnt<br \/>\ndrwxr-xr-x 2 root root 4096 Feb 22 2006 opt<br \/>\ndr-xr-xr-x 144 root root 0 Oct 2 20:00 proc \uf0df<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"justify\">Th\u01b0 m\u1ee5c proc c\u00f3 k\u00edch th\u01b0\u1edbc lu\u00f4n = 0 v\u00e0 th\u1eddi \u0111i\u1ec3m modify cu\u1ed1i c\u00f9ng l\u00e0 th\u1eddi \u0111i\u1ec3m hi\u1ec7n t\u1ea1i.<\/p>\n<h3 id=\"M\u1ed9t_s\u1ed1_t\u1eadp_tin_th\u01b0\u1eddng_g\u1eb7p_\u1edf_H\u1ec7_th\u1ed1ng_file_\/proc_(_proc_FS)\u00a0\"><span style=\"color: blue;\"><strong>M\u1ed9t s\u1ed1 t\u1eadp tin th\u01b0\u1eddng g\u1eb7p \u1edf <\/strong><\/span><span style=\"color: blue;\"><strong>H\u1ec7 th\u1ed1ng file \/proc ( proc FS)\u00a0<\/strong><\/span><\/h3>\n<p><b><tt class=\"FILENAME\">\/proc\/cpuinfo<\/tt><\/b><\/p>\n<p>Th\u00f4ng tin v\u1ec1 b\u1ed9 vi x\u1eed l\u00fd, ch\u1eb3ng h\u1ea1n nh\u01b0 lo\u1ea1i vi x\u1eed l\u00fd, make, model, hay\u00a0 hi\u1ec7u n\u0103ng.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/devices<\/tt><\/b><\/p>\n<p>Danh s\u00e1ch c\u00e1c driver thi\u1ebft b\u1ecb \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh v\u00e0o kernel hi\u1ec7n \u0111ang ch\u1ea1y<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/dma<\/tt><\/b><\/p>\n<p>Hi\u1ec3n th\u1ecb c\u00e1c k\u00eanh DMA ( Direct Memory Access ) \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng t\u1ea1i th\u1eddi \u0111i\u1ec3m n\u00e0y.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/filesystems<\/tt><\/b><\/p>\n<p>C\u00e1c Filesystems c\u1ea5u h\u00ecnh t\u1ea1i kernel.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/interrupts<\/tt><\/b><\/p>\n<p>Hi\u1ec3n th\u1ecb interrupts(x\u1eed l\u00fd ng\u1eaft) n\u00e0o \u0111ang ho\u1ea1t \u0111\u1ed9ng.<\/p>\n<p><em>Interrupts \u2013 ng\u1eaft l\u00e0 s\u1ef1 ki\u1ec7n d\u1eebng c\u00f4ng vi\u1ec7c hi\u1ec7n t\u1ea1i c\u1ee7a CPU, bu\u1ed9c CPU th\u1ef1c hi\u1ec7n m\u1ed9t vi\u1ec7c n\u00e0o \u0111\u00f3 r\u1ed3i m\u1edbi quay tr\u1edf l\u1ea1i th\u1ef1c hi\u1ec7n ti\u1ebfp c\u00f4ng vi\u1ec7c c\u0169.\u00a0<\/em><\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/ioports<\/tt><\/b><\/p>\n<p>Th\u00f4ng tin c\u00e1c\u00a0 I\/O ports \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng t\u1ea1i th\u1eddi \u0111i\u1ec3m hi\u1ec7n t\u1ea1i.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/kmsg<\/tt><\/b><\/p>\n<p>Tin nh\u1eafn \u0111\u01b0\u1ee3c t\u1ea1o b\u1edfi kernel.Tin nh\u1eafn n\u00e0y c\u0169ng \u0111\u01b0\u1ee3c chuy\u1ec3n v\u00e0o syslog.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/loadavg<\/tt><\/b><\/p>\n<p>Th\u00f4ng tin load trung b\u00ecnh c\u1ee7a h\u1ec7 th\u1ed1ng, ngo\u00e0i 3 con s\u1ed1 th\u00f4ng th\u01b0\u1eddng t\u01b0\u01a1ng \u1ee9ng v\u1edbi t\u00ecnh tr\u1ea1ng load c\u1ee7a h\u1ec7 th\u1ed1ng trong 1, 5 v\u00e0 15 ph\u00fat. Ngo\u00e0i ra c\u00f2n c\u00f3 2 con s\u1ed1.<\/p>\n<p>S\u1ed1 thread \u0111ang ho\u1eb7c \u0111\u1ee3i ch\u1ea1y \/ t\u1ed5ng s\u1ed1 thread h\u1ec7 th\u1ed1ng.<\/p>\n<p>PID process m\u1edbi nh\u1ea5t c\u1ee7a h\u1ec7 th\u1ed1ng.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/meminfo<\/tt><\/b><\/p>\n<p>Th\u00f4ng tin v\u1ec1 memeory usage, bao g\u1ed3m c\u1ea3 th\u00f4ng tin v\u1ec1 ram v\u00e0 swap (ram \u1ea3o).<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/modules<\/tt><\/b><\/p>\n<p>C\u00e1c module kernel \u0111\u01b0\u1ee3c load t\u1ea1i th\u1eddi \u0111i\u1ec3m n\u00e0y.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/net<\/tt><\/b><\/p>\n<p>Th\u00f4ng tin tr\u1ea1ng th\u00e1i v\u1ec1 c\u00e1c giao th\u1ee9c m\u1ea1ng.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/self<\/tt><\/b><\/p>\n<div class=\"tlid-results-container results-container\">\n<div class=\"tlid-result result-dict-wrapper\">\n<div class=\"result tlid-copy-target\">\n<div class=\"result-header\">\n<div class=\"starbutton jfk-button-flat jfk-button unstarred\" tabindex=\"0\" role=\"button\" aria-label=\"G\u1eafn d\u1ea5u sao b\u1ea3n d\u1ecbch\" data-tooltip=\"G\u1eafn d\u1ea5u sao b\u1ea3n d\u1ecbch\" data-tooltip-align=\"t,c\">\n<div class=\"jfk-button-img\"><\/div>\n<\/div>\n<\/div>\n<div class=\"text-wrap tlid-copy-target\">\n<div class=\"result-shield-container tlid-copy-target\" tabindex=\"0\"><span class=\"tlid-translation translation\" lang=\"vi\"><span class=\"\" title=\"\">M\u1ed9t<em><strong> symbolic link<\/strong> <\/em>\u0111\u1ebfn th\u01b0 m\u1ee5c c\u1ee7a ch\u01b0\u01a1ng tr\u00ecnh \u0111ang xem \/ Proc.<\/span> <span title=\"\">Khi hai qu\u00e1 tr\u00ecnh\u00a0 s\u1eed d\u1ee5ng \/ Proc, ch\u00fang nh\u1eadn \u0111\u01b0\u1ee3c c\u00e1c li\u00ean k\u1ebft kh\u00e1c nhau.<\/span><\/span><\/div>\n<div tabindex=\"0\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><b><tt class=\"FILENAME\">\/proc\/stat<\/tt><\/b><\/p>\n<p>Th\u1ed1ng k\u00ea kh\u00e1c nhau v\u1ec1 h\u1ec7 th\u1ed1ng, ch\u1eb3ng h\u1ea1n nh\u01b0 s\u1ed1 l\u1ed7i trang k\u1ec3 t\u1eeb khi h\u1ec7 th\u1ed1ng \u0111\u01b0\u1ee3c kh\u1edfi \u0111\u1ed9ng.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/uptime<\/tt><\/b><\/p>\n<p>Th\u1eddi gian h\u1ec7 th\u1ed1ng ho\u1ea1t \u0111\u1ed9ng.<\/p>\n<p><b><tt class=\"FILENAME\">\/proc\/version<\/tt><\/b><\/p>\n<p>Phi\u00ean b\u1ea3n c\u1ee7a kernel .<\/p>\n<p>C\u00e1c th\u01b0 m\u1ee5c \u0111\u01b0\u1ee3c \u0111\u00e1nh s\u1ed1 nh\u01b0 1, 4567, 2385, 112, 40, 41 \u2026 ch\u00ednh l\u00e0 c\u00e1c Process ID (PID) c\u1ee7a nh\u1eefng process \u0111ang ch\u1ea1y trong h\u1ec7 th\u1ed1ng. M\u1ed7i th\u01b0 m\u1ee5c s\u1ebd ch\u1ee9a th\u00f4ng tin v\u1ec1 process \u0111\u00f3. B\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh \u201cps \u2013ef\u201d \u0111\u1ec3 li\u1ec7t k\u00ea c\u00e1c process \u0111ang ch\u1ea1y v\u00e0 so s\u00e1nh v\u1edbi t\u00ean c\u00e1c th\u01b0 m\u1ee5c tr\u00ean \u0111\u1ec3 bi\u1ebft th\u01b0 m\u1ee5c n\u00e0o ch\u1ee9a th\u00f4ng tin c\u1ee7a process n\u00e0o. N\u1ebfu \u0111ang d\u00f9ng giao di\u1ec7n KDE b\u1ea1n c\u00f3 th\u1ec3 th\u1eed ph\u00edm t\u1eaft Ctrl + ESC). H\u00e3y cd v\u00e0o m\u1ed9t th\u01b0 m\u1ee5c n\u00e0o \u0111\u00f3, s\u1ed1 1 ch\u1eb3ng h\u1ea1n, v\u00e0 ls ra \u0111\u1ec3 xem c\u00f3 g\u00ec trong \u0111\u00f3.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00f3 bao gi\u1edd c\u00e1c b\u1ea1n t\u1ef1 h\u1ecfi l\u00e0 nh\u1eefng ch\u01b0\u01a1ng tr\u00ecnh m\u00ecnh hay s\u1eed d\u1ee5ng nh\u01b0 top, ps, free hay KDE System Guard l\u00e0m th\u1ebf n\u00e0o l\u1ea5y \u0111\u01b0\u1ee3c th\u00f4ng tin v\u1ec1 h\u1ec7 th\u1ed1ng nh\u01b0 c\u00e1c process \u0111ang ch\u1ea1y, l\u01b0\u1ee3ng b\u1ed9 nh\u1edb c\u00f2n tr\u1ed1ng, l\u01b0\u1ee3ng CPU \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u2026 hay kh\u00f4ng? C\u00e1c b\u1ea1n \u0111ang [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":2433,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"tags":[],"ht_kb_category":[17],"class_list":["post-1927","ht_kb","type-ht_kb","status-publish","format-standard","has-post-thumbnail","hentry","ht_kb_category-huong-dan-ve-cloud-vps"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/1927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=1927"}],"version-history":[{"count":0,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb\/1927\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/2433"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=1927"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=1927"},{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/ht_kb_category?post=1927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}