{"id":94826,"date":"2026-04-12T18:54:01","date_gmt":"2026-04-12T11:54:01","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=94826"},"modified":"2026-04-12T18:54:03","modified_gmt":"2026-04-12T11:54:03","slug":"huong-dan-su-dung-linux-command","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/","title":{"rendered":"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_command_la_gi\" >Linux command l\u00e0 g\u00ec?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_thuc_thi_mot_command_nhu_the_nao\" >Linux th\u1ef1c thi m\u1ed9t command nh\u01b0 th\u1ebf n\u00e0o?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Cau_truc_Linux_command_co_ban\" >C\u1ea5u tr\u00fac Linux command c\u01a1 b\u1ea3n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_command_Lenh_lam_viec_voi_he_thong_file\" >Linux command: L\u1ec7nh l\u00e0m vi\u1ec7c v\u1edbi h\u1ec7 th\u1ed1ng file\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_command_Lenh_doc_noi_dung_file\" >Linux command: L\u1ec7nh \u0111\u1ecdc n\u1ed9i dung file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_command_Lenh_quan_ly_he_thong\" >Linux command: L\u1ec7nh qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_command_Lenh_ve_mang\" >Linux command: L\u1ec7nh v\u1ec1 m\u1ea1ng<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Linux_command_Lenh_Permissions_va_ownership\" >Linux command: L\u1ec7nh Permissions v\u00e0 ownership<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Kinh_nghiem_su_dung_Linux_command_hieu_qua\" >Kinh nghi\u1ec7m s\u1eed d\u1ee5ng Linux command hi\u1ec7u qu\u1ea3<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Cac_cau_hoi_thuong_gap_ve_Linux_command\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Linux command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#Tong_ket\" >T\u1ed5ng k\u1ebft<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><strong><em>Linux command line l\u00e0 m\u1ed9t trong nh\u1eefng c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd nh\u1ea5t m\u00e0 h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux mang l\u1ea1i. Th\u00f4ng qua c\u00e1c command, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 qu\u1ea3n l\u00fd file, h\u1ec7 th\u1ed1ng, m\u1ea1ng, quy\u1ec1n truy c\u1eadp v\u00e0 t\u1ef1 \u0111\u1ed9ng h\u00f3a c\u00f4ng vi\u1ec7c m\u1ed9t c\u00e1ch nhanh ch\u00f3ng v\u00e0 ch\u00ednh x\u00e1c.<\/em><\/strong><\/p>\n\n\n\n<p>\u0110\u1ecdc b\u00e0i vi\u1ebft n\u00e0y \u0111\u1ec3 hi\u1ec3u r\u00f5 h\u01a1n v\u1ec1:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Linux command l\u00e0 g\u00ec?<\/li>\n\n\n\n<li>Linux th\u1ef1c thi m\u1ed9t command nh\u01b0 th\u1ebf n\u00e0o?<\/li>\n\n\n\n<li>C\u00e1ch s\u1eed d\u1ee5ng c\u00e1c l\u1ec7nh linux c\u0103n b\u1ea3n<\/li>\n\n\n\n<li>Kinh nghi\u1ec7m s\u1eed d\u1ee5ng Linux command hi\u1ec7u qu\u1ea3<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-command-la-gi\"><span class=\"ez-toc-section\" id=\"Linux_command_la_gi\"><\/span><strong>Linux command l\u00e0 g\u00ec?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Trong <strong><a href=\"https:\/\/itviec.com\/blog\/linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux<\/a><\/strong>, command (l\u1ec7nh) l\u00e0 c\u00e1ch ph\u1ed5 bi\u1ebfn v\u00e0 tr\u1ef1c ti\u1ebfp nh\u1ea5t \u0111\u1ec3 ng\u01b0\u1eddi d\u00f9ng giao ti\u1ebfp v\u1edbi h\u1ec7 \u0111i\u1ec1u h\u00e0nh. Th\u00f4ng qua command-line interface (CLI) ho\u1eb7c terminal, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 qu\u1ea3n l\u00fd file, user, ti\u1ebfn tr\u00ecnh, m\u1ea1ng, c\u00e0i \u0111\u1eb7t ph\u1ea7n m\u1ec1m v\u00e0 ki\u1ec3m so\u00e1t g\u1ea7n nh\u01b0 m\u1ecdi kh\u00eda c\u1ea1nh c\u1ee7a h\u1ec7 th\u1ed1ng. Thay v\u00ec thao t\u00e1c b\u1eb1ng giao di\u1ec7n \u0111\u1ed3 h\u1ecda, Linux cho ph\u00e9p b\u1ea1n ra l\u1ec7nh b\u1eb1ng v\u0103n b\u1ea3n, gi\u00fap thao t\u00e1c nhanh, ch\u00ednh x\u00e1c v\u00e0 d\u1ec5 t\u1ef1 \u0111\u1ed9ng h\u00f3a.\u00a0<\/p>\n\n\n\n<p>V\u1ec1 b\u1ea3n ch\u1ea5t, m\u1ed9t Linux command c\u00f3 th\u1ec3 l\u00e0 m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh th\u1ef1c thi (nh\u01b0 <code>ls<\/code>, <code>cp<\/code>, <code>rm<\/code>), m\u1ed9t built-in command c\u1ee7a shell (nh\u01b0 <code>cd<\/code>, <code>export<\/code>) ho\u1eb7c m\u1ed9t script do ng\u01b0\u1eddi d\u00f9ng vi\u1ebft.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-th\u1ef1c-thi-m\u1ed9t-command-nh\u01b0-th\u1ebf-nao\"><span class=\"ez-toc-section\" id=\"Linux_thuc_thi_mot_command_nhu_the_nao\"><\/span><strong>Linux th\u1ef1c thi m\u1ed9t command nh\u01b0 th\u1ebf n\u00e0o?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Qu\u00e1 tr\u00ecnh th\u1ef1c thi m\u1ed9t command trong Linux c\u00f3 th\u1ec3 hi\u1ec3u theo c\u00e1c b\u01b0\u1edbc sau:<\/p>\n\n\n\n<p><strong>B\u01b0\u1edbc 1<\/strong>:<\/p>\n\n\n\n<p>Ng\u01b0\u1eddi d\u00f9ng nh\u1eadp l\u1ec7nh trong terminal: user g\u00f5 l\u1ec7nh v\u00e0o terminal (v\u00ed d\u1ee5: <code>ls -l \/home<\/code>). Terminal ch\u1ec9 \u0111\u00f3ng vai tr\u00f2 l\u00e0 c\u00f4ng c\u1ee5 nh\u1eadp\/xu\u1ea5t, n\u00f3 kh\u00f4ng x\u1eed l\u00fd l\u1ec7nh m\u00e0 chuy\u1ec3n n\u1ed9i dung n\u00e0y cho shell (th\u01b0\u1eddng l\u00e0 Bash tr\u00ean h\u1ea7u h\u1ebft c\u00e1c h\u1ec7 th\u1ed1ng Linux).<\/p>\n\n\n\n<p><strong>B\u01b0\u1edbc 2<\/strong>:<\/p>\n\n\n\n<p>Shell ph\u00e2n t\u00edch l\u1ec7nh (parsing): V\u00ed d\u1ee5 m\u1ed9t Shell Bash s\u1ebd:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>T\u00e1ch l\u1ec7nh th\u00e0nh command v\u00e0 c\u00e1c option\/argument,<\/li>\n\n\n\n<li>X\u1eed l\u00fd bi\u1ebfn m\u00f4i tr\u01b0\u1eddng (nh\u01b0 <code>$HOME<\/code>, <code>$PATH<\/code>),<\/li>\n\n\n\n<li>X\u1eed l\u00fd wildcard (<code>*<\/code>, <code>?<\/code>, <code>[]<\/code>),<\/li>\n\n\n\n<li>Ki\u1ec3m tra redirect (<code>><\/code>, <code>&lt;<\/code>, <code>|<\/code>) v\u00e0 pipe.<\/li>\n<\/ul>\n\n\n\n<p><strong>B\u01b0\u1edbc 3<\/strong>:<\/p>\n\n\n\n<p>X\u00e1c \u0111\u1ecbnh lo\u1ea1i command: Shell s\u1ebd ki\u1ec3m tra theo th\u1ee9 t\u1ef1:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Built-in command c\u1ee7a shell (v\u00ed d\u1ee5 <code>cd<\/code>)&nbsp; \u0111\u01b0\u1ee3c th\u1ef1c thi tr\u1ef1c ti\u1ebfp b\u1edfi shell<\/li>\n\n\n\n<li>Alias (n\u1ebfu c\u00f3)<\/li>\n\n\n\n<li>File th\u1ef1c thi trong c\u00e1c th\u01b0 m\u1ee5c \u0111\u01b0\u1ee3c khai b\u00e1o trong bi\u1ebfn <code>$PATH<\/code><br>Shell s\u1ebd t\u00ecm ki\u1ebfm t\u1eebng th\u01b0 m\u1ee5c trong <code>$PATH<\/code> theo th\u1ee9 t\u1ef1 cho \u0111\u1ebfn khi t\u00ecm th\u1ea5y file th\u1ef1c thi ph\u00f9 h\u1ee3p. N\u1ebfu kh\u00f4ng t\u00ecm th\u1ea5y command h\u1ee3p l\u1ec7, shell s\u1ebd b\u00e1o l\u1ed7i <em>command not found<\/em>.<\/li>\n<\/ol>\n\n\n\n<p><strong>B\u01b0\u1edbc 4<\/strong>:<\/p>\n\n\n\n<p>T\u1ea1o process v\u00e0 g\u1ecdi kernel: Khi command l\u00e0 m\u1ed9t ch\u01b0\u01a1ng tr\u00ecnh th\u1ef1c thi, shell s\u1ebd t\u1ea1o m\u1ed9t process m\u1edbi b\u1eb1ng <code>fork()\u00a0<\/code> \u0111\u1ec3 t\u1ea1o m\u1ed9t b\u1ea3n sao c\u1ee7a ch\u00ednh n\u00f3, y\u00eau c\u1ea7u kernel ch\u1ea1y ch\u01b0\u01a1ng tr\u00ecnh \u0111\u00f3 b\u1eb1ng <code>exec()<\/code> \u0111\u1ec3 thay th\u1ebf process con b\u1eb1ng ch\u01b0\u01a1ng tr\u00ecnh m\u1edbi. T\u1eeb th\u1eddi \u0111i\u1ec3m n\u00e0y, Linux kernel ch\u1ecbu tr\u00e1ch nhi\u1ec7m c\u1ea5p CPU, c\u1ea5p b\u1ed9 nh\u1edb, qu\u1ea3n l\u00fd I\/O v\u00e0 theo d\u00f5i ti\u1ebfn tr\u00ecnh.<\/p>\n\n\n\n<p><strong>B\u01b0\u1edbc 5<\/strong>:<\/p>\n\n\n\n<p>Th\u1ef1c thi v\u00e0 tr\u1ea3 k\u1ebft qu\u1ea3: Ch\u01b0\u01a1ng tr\u00ecnh ch\u1ea1y xong s\u1ebd tr\u1ea3 output v\u1ec1 terminal v\u00e0 tr\u1ea3 exit code (0 = th\u00e0nh c\u00f4ng, kh\u00e1c 0 = l\u1ed7i). Sau \u0111\u00f3, Shell s\u1ebd hi\u1ec3n th\u1ecb k\u1ebft qu\u1ea3 cho ng\u01b0\u1eddi d\u00f9ng v\u00e0 s\u1eb5n s\u00e0ng nh\u1eadn l\u1ec7nh ti\u1ebfp theo.<\/p>\n\n\n\n<p>Gi\u1ea3 s\u1eed ta ch\u1ea1y l\u1ec7nh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls \/home<\/code><\/pre>\n\n\n\n<p>Linux s\u1ebd x\u1eed l\u00fd nh\u01b0 sau:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Terminal nh\u1eadn input v\u00e0 g\u1eedi cho Bash<\/li>\n\n\n\n<li>Bash ph\u00e2n t\u00edch l\u1ec7nh, x\u00e1c \u0111\u1ecbnh <code>ls<\/code> l\u00e0 command v\u00e0 <code>\/home<\/code> l\u00e0 argument<\/li>\n\n\n\n<li>Bash x\u00e1c \u0111\u1ecbnh <code>ls<\/code> l\u00e0 ch\u01b0\u01a1ng tr\u00ecnh trong <code>\/bin\/ls<\/code><\/li>\n\n\n\n<li>Kernel t\u1ea1o process m\u1edbi cho <code>ls<\/code><\/li>\n\n\n\n<li><code>ls<\/code> \u0111\u1ecdc th\u01b0 m\u1ee5c <code>\/home<\/code><\/li>\n\n\n\n<li>K\u1ebft qu\u1ea3 \u0111\u01b0\u1ee3c tr\u1ea3 v\u1ec1 terminal v\u00e0 hi\u1ec3n th\u1ecb ra m\u00e0n h\u00ecnh<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-c\u1ea5u-truc-linux-command-c\u01a1-b\u1ea3n\"><span class=\"ez-toc-section\" id=\"Cau_truc_Linux_command_co_ban\"><\/span><strong>C\u1ea5u tr\u00fac Linux command c\u01a1 b\u1ea3n<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>N\u1ebfu coi Linux nh\u01b0 m\u1ed9t \u201cx\u01b0\u1edfng m\u00e1y\u201d, th\u00ec command line l\u00e0 b\u1ea3ng \u0111i\u1ec1u khi\u1ec3n, c\u00f2n Linux commands l\u00e0 nh\u1eefng n\u00fat b\u1ea5m\/\u0111\u00f2n b\u1ea9y gi\u00fap b\u1ea1n thao t\u00e1c v\u1edbi file, ti\u1ebfn tr\u00ecnh, m\u1ea1ng, quy\u1ec1n truy c\u1eadp\u2026<\/p>\n\n\n\n<p>C\u00e1c l\u1ec7nh th\u01b0\u1eddng c\u00f3 d\u1ea1ng nh\u01b0 sau:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>command &#91;options] &#91;arguments]<\/code><\/pre>\n\n\n\n<p>Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>command<\/strong>: t\u00ean l\u1ec7nh (vd: <code>ls<\/code>, <code>cp<\/code>, <code>ps<\/code>)<\/li>\n\n\n\n<li><strong>options<\/strong>: tu\u1ef3 ch\u1ecdn, th\u01b0\u1eddng b\u1eaft \u0111\u1ea7u b\u1eb1ng <code>-<\/code> ho\u1eb7c <code>--<\/code> (vd: <code>-l<\/code>, <code>--human-readable<\/code>)<\/li>\n\n\n\n<li><strong>arguments<\/strong>: \u0111\u1ed1i t\u01b0\u1ee3ng t\u00e1c \u0111\u1ed9ng (file, th\u01b0 m\u1ee5c, IP, service\u2026)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-command-l\u1ec7nh-lam-vi\u1ec7c-v\u1edbi-h\u1ec7-th\u1ed1ng-file\"><span class=\"ez-toc-section\" id=\"Linux_command_Lenh_lam_viec_voi_he_thong_file\"><\/span><strong>Linux command: L\u1ec7nh l\u00e0m vi\u1ec7c v\u1edbi h\u1ec7 th\u1ed1ng file\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u0110\u00e2y l\u00e0 nh\u00f3m l\u1ec7nh b\u1ea1n d\u00f9ng m\u1ed7i ng\u00e0y: \u0111i l\u1ea1i gi\u1eefa th\u01b0 m\u1ee5c, xem danh s\u00e1ch file, t\u1ea1o\/sao ch\u00e9p\/di chuy\u1ec3n\/x\u00f3a, t\u1ea1o link\u2026<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>L\u1ec7nh<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><code>pwd<\/code><\/td><td>Hi\u1ec3n th\u1ecb th\u01b0 m\u1ee5c hi\u1ec7n t\u1ea1i<\/td><td><code>pwd<\/code> &#8211; ki\u1ec3m tra v\u1ecb tr\u00ed hi\u1ec7n t\u1ea1i tr\u01b0\u1edbc khi thao t\u00e1c<\/td><\/tr><tr><td><code>cd<\/code><\/td><td>Di chuy\u1ec3n gi\u1eefa c\u00e1c th\u01b0 m\u1ee5c<\/td><td><code>cd \/var\/log<\/code> &#8211; v\u00e0o th\u01b0 m\u1ee5c ch\u1ee9a log<\/td><\/tr><tr><td><code>ls<\/code><\/td><td>Li\u1ec7t k\u00ea file\/th\u01b0 m\u1ee5c<\/td><td><code>ls -lh<\/code> &#8211; xem file k\u00e8m dung l\u01b0\u1ee3ng v\u00e0 quy\u1ec1n<\/td><\/tr><tr><td><code>mkdir<\/code><\/td><td>T\u1ea1o th\u01b0 m\u1ee5c m\u1edbi<\/td><td><code>mkdir -p data\/logs<\/code> &#8211; t\u1ea1o c\u1ea5u tr\u00fac th\u01b0 m\u1ee5c<\/td><\/tr><tr><td><code>touch<\/code><\/td><td>T\u1ea1o file r\u1ed7ng<\/td><td><code>touch app.log<\/code> &#8211; t\u1ea1o file log<\/td><\/tr><tr><td><code>cp<\/code><\/td><td>Sao ch\u00e9p file\/th\u01b0 m\u1ee5c<\/td><td><code>cp -r src backup<\/code> &#8211; sao l\u01b0u source<\/td><\/tr><tr><td><code>mv<\/code><\/td><td>Di chuy\u1ec3n\/\u0111\u1ed5i t\u00ean<\/td><td><code>mv a.txt b.txt<\/code> &#8211; \u0111\u1ed5i t\u00ean file<\/td><\/tr><tr><td><code>rm<\/code><\/td><td>X\u00f3a file\/th\u01b0 m\u1ee5c<\/td><td><code>rm -r old_logs<\/code> &#8211; x\u00f3a log c\u0169<\/td><\/tr><tr><td><code>ln -s<\/code><\/td><td>T\u1ea1o symbolic link<\/td><td><code>ln -s \/var\/log\/app.log app.log<\/code> \u2013 t\u1ea1o shortcut<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-di\u1ec1u-h\u01b0\u1edbng-amp-xac-d\u1ecbnh-v\u1ecb-tri\"><strong>\u0110i\u1ec1u h\u01b0\u1edbng &amp; x\u00e1c \u0111\u1ecbnh v\u1ecb tr\u00ed<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pwd<\/code>: cho bi\u1ebft b\u1ea1n \u0111ang \u0111\u1ee9ng \u1edf \u0111\u00e2u (\u0111\u01b0\u1eddng d\u1eabn hi\u1ec7n t\u1ea1i).<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>pwd<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>cd<\/code>: di chuy\u1ec3n gi\u1eefa c\u00e1c th\u01b0 m\u1ee5c.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/var\/log  # Di chuy\u1ec3n v\u00e0o th\u01b0 m\u1ee5c \/var\/log\ncd ..        # l\u00f9i 1 c\u1ea5p\ncd ~         # v\u1ec1 home d\ncd -         # quay l\u1ea1i th\u01b0 m\u1ee5c tr\u01b0\u1edbc \u0111\u00f3<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-li\u1ec7t-ke-amp-quan-sat-file-th\u01b0-m\u1ee5c-v\u1edbi-ls\"><strong>Li\u1ec7t k\u00ea &amp; quan s\u00e1t file\/th\u01b0 m\u1ee5c v\u1edbi<\/strong> <code>ls<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ls\nls -l        # hi\u1ec3n th\u1ecb metadata m\u00e0 filesystem \u0111ang l\u01b0u (permissions, owner\/group, mtime...\nls -a        # hi\u1ec7n c\u1ea3 file \u1ea9n (b\u1eaft \u0111\u1ea7u b\u1eb1ng .)\nls -lh       # size d\u1ec5 \u0111\u1ecdc (KB\/MB\/GB)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-t\u1ea1o-th\u01b0-m\u1ee5c-file-r\u1ed7ng\"><strong>T\u1ea1o th\u01b0 m\u1ee5c \/ file r\u1ed7ng<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>mkdir<\/code>: t\u1ea1o th\u01b0 m\u1ee5c.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir logs\nmkdir -p a\/b\/c   # t\u1ea1o c\u1ea3 c\u00e2y th\u01b0 m\u1ee5c n\u1ebfu ch\u01b0a c\u00f3<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>touch<\/code>: t\u1ea1o file r\u1ed7ng ho\u1eb7c c\u1eadp nh\u1eadt timestamp file.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>touch app.log<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-sao-chep-di-chuy\u1ec3n-d\u1ed5i-ten\"><strong>Sao ch\u00e9p \/ di chuy\u1ec3n \/ \u0111\u1ed5i t\u00ean<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>cp<\/code>: sao ch\u00e9p file\/th\u01b0 m\u1ee5c.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cp a.txt b.txt\ncp -r src\/ backup\/     # copy th\u01b0 m\u1ee5c\ncp -i a.txt b.txt      # h\u1ecfi tr\u01b0\u1edbc khi ghi \u0111\u00e8<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>mv<\/code>: di chuy\u1ec3n ho\u1eb7c \u0111\u1ed5i t\u00ean.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mv old.txt new.txt           # \u0111\u1ed5i t\u00ean\nmv build\/ \/tmp\/build\/      # di chuy\u1ec3n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-xoa-file-th\u01b0-m\u1ee5c-v\u1edbi-rm\"><strong>Xo\u00e1 file\/th\u01b0 m\u1ee5c<\/strong> <strong>v\u1edbi<\/strong> <code>rm<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>rm a.txt\nrm -r folder\/     # x\u00f3a th\u01b0 m\u1ee5c + n\u1ed9i dung\nrm -rf folder\/    # c\u01b0\u1ee1ng b\u1ee9c (r\u1ea5t nguy hi\u1ec3m n\u1ebfu g\u00f5 nh\u1ea7m)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-lien-k\u1ebft-link\"><strong>Li\u00ean k\u1ebft (link)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>T\u1ea1o link v\u1edbi <code>ln<\/code>:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/var\/log\/nginx\/access.log nginx-access.log<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Symbolic link (<code>-s<\/code>) gi\u1ed1ng shortcut: tr\u1ecf t\u1edbi \u0111\u01b0\u1eddng d\u1eabn.<\/li>\n\n\n\n<li>Hard link (kh\u00f4ng <code>-s<\/code>) tr\u1ecf t\u1edbi c\u00f9ng inode v\u1edbi file g\u1ed1c. File ch\u1ec9 th\u1ef1c s\u1ef1 b\u1ecb x\u00f3a khi kh\u00f4ng c\u00f2n hard link n\u00e0o tr\u1ecf t\u1edbi n\u00f3. Hard link kh\u00f4ng th\u1ec3 t\u1ea1o cho th\u01b0 m\u1ee5c v\u00e0 kh\u00f4ng th\u1ec3 v\u01b0\u1ee3t qua ranh gi\u1edbi filesystem.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-command-l\u1ec7nh-d\u1ecdc-n\u1ed9i-dung-file\"><span class=\"ez-toc-section\" id=\"Linux_command_Lenh_doc_noi_dung_file\"><\/span><strong>Linux command: L\u1ec7nh \u0111\u1ecdc n\u1ed9i dung file<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>L\u00e0 nh\u00f3m l\u1ec7nh gi\u00fap b\u1ea1n xem nhanh n\u1ed9i dung file, \u0111\u1ecdc file l\u1edbn theo t\u1eebng trang v\u00e0 l\u1ecdc th\u00f4ng tin c\u1ea7n thi\u1ebft, \u0111\u1eb7c bi\u1ec7t h\u1eefu \u00edch khi debug log ho\u1eb7c ki\u1ec3m tra c\u1ea5u h\u00ecnh.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>L\u1ec7nh<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><code>cat<\/code><\/td><td>In to\u00e0n b\u1ed9 n\u1ed9i dung file<\/td><td><code>cat config.yml<\/code> &#8211; xem nhanh file nh\u1ecf<\/td><\/tr><tr><td><code>less<\/code><\/td><td>\u0110\u1ecdc file theo trang<\/td><td><code>less syslog<\/code> &#8211; \u0111\u1ecdc file log l\u1edbn<\/td><\/tr><tr><td><code>head<\/code><\/td><td>Xem d\u00f2ng \u0111\u1ea7u file<\/td><td><code>head -n 20 app.log<\/code> &#8211; xem header\/log \u0111\u1ea7u<\/td><\/tr><tr><td><code>tail<\/code><\/td><td>Xem d\u00f2ng cu\u1ed1i file<\/td><td><code>tail -n 50 app.log<\/code> &#8211; xem log m\u1edbi<\/td><\/tr><tr><td><code>tail -f<\/code><\/td><td>Theo d\u00f5i log realtime<\/td><td><code>tail -f app.log<\/code> &#8211; xem log khi app ch\u1ea1y<\/td><\/tr><tr><td><code>grep<\/code><\/td><td>T\u00ecm\/l\u1ecdc n\u1ed9i dung<\/td><td><code>grep error app.log<\/code> &#8211; l\u1ecdc d\u00f2ng l\u1ed7i<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-d\u1ecdc-toan-b\u1ed9-nhanh-nh\u01b0ng-co-th\u1ec3-tran-man-hinh\"><strong>\u0110\u1ecdc to\u00e0n b\u1ed9 (nhanh nh\u01b0ng c\u00f3 th\u1ec3 \u201ctr\u00e0n m\u00e0n h\u00ecnh\u201d)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>cat<\/code>: in to\u00e0n b\u1ed9 n\u1ed9i dung ra terminal, ph\u00f9 h\u1ee3p khi d\u00f9ng file nh\u1ecf.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cat config.json<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-d\u1ecdc-theo-trang-khuyen-dung\"><strong>\u0110\u1ecdc theo trang (khuy\u00ean d\u00f9ng)<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>less<\/code>: \u0111\u1ecdc n\u1ed9i dung theo trang, cu\u1ed9n l\u00ean\/xu\u1ed1ng, t\u00ecm ki\u1ebfm, ph\u00f9 h\u1ee3p v\u1edbi file log l\u1edbn.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>less \/var\/log\/syslog<\/code><\/pre>\n\n\n\n<p>C\u00e1c ph\u00edm t\u1eaft trong less:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Space <\/code>ho\u1eb7c <code>Page Down<\/code>: xu\u1ed1ng trang<\/li>\n\n\n\n<li><code>b<\/code> ho\u1eb7c <code>Page Up<\/code>: l\u00ean trang<\/li>\n\n\n\n<li><code>\/pattern<\/code>: t\u00ecm ki\u1ebfm v\u1ec1 ph\u00eda tr\u01b0\u1edbc<\/li>\n\n\n\n<li><code>?pattern<\/code>: t\u00ecm ki\u1ebfm v\u1ec1 ph\u00eda sau<\/li>\n\n\n\n<li><code>q<\/code>: tho\u00e1t<\/li>\n\n\n\n<li><code>g<\/code>: v\u1ec1 \u0111\u1ea7u file<\/li>\n\n\n\n<li><code>G<\/code>: v\u1ec1 cu\u1ed1i file<\/li>\n\n\n\n<li><code>more<\/code>: t\u01b0\u01a1ng t\u1ef1 less nh\u01b0ng \u00edt t\u00ednh n\u0103ng h\u01a1n (ch\u1ec9 cu\u1ed9n xu\u1ed1ng, kh\u00f4ng cu\u1ed9n l\u00ean).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-xem-d\u1ea7u-cu\u1ed1i-file\"><strong>Xem \u0111\u1ea7u\/cu\u1ed1i file<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>head<\/code>: xem v\u00e0i d\u00f2ng \u0111\u1ea7u.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>head -n 20 app.log<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>tail<\/code>: xem v\u00e0i d\u00f2ng cu\u1ed1i.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tail -n 50 app.log\ntail -f app.log     # \u201cfollow\u201d log theo th\u1eddi gian th\u1ef1c<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-tim-ki\u1ebfm-theo-m\u1eabu\"><strong>T\u00ecm ki\u1ebfm theo m\u1eabu<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>grep<\/code>: l\u1ecdc d\u00f2ng ch\u1ee9a chu\u1ed7i\/m\u1eabu.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>grep \"ERROR\" app.log\ngrep -n \"ERROR\" app.log     # k\u00e8m s\u1ed1 d\u00f2ng\ngrep -i \"error\" app.log     # kh\u00f4ng ph\u00e2n bi\u1ec7t hoa th\u01b0\u1eddng\ngrep -r \"TODO\" src\/         # t\u00ecm \u0111\u1ec7 quy trong th\u01b0 m\u1ee5c<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-k\u1ebft-h\u1ee3p-pipe-d\u1ec3-d\u1ecdc-thong-minh\"><strong>K\u1ebft h\u1ee3p pipe \u0111\u1ec3 \u0111\u1ecdc \u201cth\u00f4ng minh\u201d<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>V\u00ed d\u1ee5 ta xem 200 d\u00f2ng cu\u1ed1i log r\u1ed3i l\u1ecdc error:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>tail -n 200 app.log | grep -i \"error\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-command-l\u1ec7nh-qu\u1ea3n-ly-h\u1ec7-th\u1ed1ng\"><span class=\"ez-toc-section\" id=\"Linux_command_Lenh_quan_ly_he_thong\"><\/span><strong>Linux command: L\u1ec7nh qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Nh\u00f3m n\u00e0y t\u1eadp trung v\u00e0o vi\u1ec7c xem ti\u1ebfn tr\u00ecnh, d\u1eebng ti\u1ebfn tr\u00ecnh, theo d\u00f5i t\u00e0i nguy\u00ean, qu\u1ea3n l\u00fd d\u1ecbch v\u1ee5 v\u00e0 xem th\u00f4ng tin h\u1ec7 th\u1ed1ng.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>L\u1ec7nh<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><code>ps<\/code><\/td><td>Xem danh s\u00e1ch ti\u1ebfn tr\u00ecnh<\/td><td><code>ps aux<\/code> &#8211; xem to\u00e0n b\u1ed9 process<\/td><\/tr><tr><td><code>top<\/code><\/td><td>Theo d\u00f5i h\u1ec7 th\u1ed1ng realtime<\/td><td><code>top<\/code> &#8211; t\u00ecm process ng\u1ed1n CPU\/RAM<\/td><\/tr><tr><td><code>kill<\/code><\/td><td>D\u1eebng ti\u1ebfn tr\u00ecnh theo PID<\/td><td><code>kill 1234<\/code> &#8211; d\u1eebng process b\u1ecb treo<\/td><\/tr><tr><td><code>killall<\/code><\/td><td>D\u1eebng ti\u1ebfn tr\u00ecnh theo t\u00ean<\/td><td><code>killall nginx<\/code> &#8211; d\u1eebng nginx<\/td><\/tr><tr><td><code>df<\/code><\/td><td>Ki\u1ec3m tra dung l\u01b0\u1ee3ng disk<\/td><td><code>df -h<\/code> &#8211; xem \u1ed5 \u0111\u0129a c\u00f2n tr\u1ed1ng<\/td><\/tr><tr><td><code>du<\/code><\/td><td>Xem dung l\u01b0\u1ee3ng th\u01b0 m\u1ee5c<\/td><td><code>du -sh \/var\/log<\/code> &#8211; ki\u1ec3m tra log chi\u1ebfm disk<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-xem-ti\u1ebfn-trinh\"><strong>Xem ti\u1ebfn tr\u00ecnh<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ps<\/code>: ch\u1ee5p nhanh danh s\u00e1ch ti\u1ebfn tr\u00ecnh.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ps aux<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>a<\/code>: ti\u1ebfn tr\u00ecnh c\u1ee7a m\u1ecdi user<\/li>\n\n\n\n<li><code>u<\/code>: hi\u1ec3n th\u1ecb d\u1ea1ng \u201cuser-friendly\u201d<\/li>\n\n\n\n<li><code>x<\/code>: g\u1ed3m c\u1ea3 ti\u1ebfn tr\u00ecnh kh\u00f4ng g\u1eafn terminal<br><\/li>\n\n\n\n<li><code>top<\/code> (ho\u1eb7c <code>htop<\/code> n\u1ebfu c\u00f3): xem realtime CPU\/RAM theo ti\u1ebfn tr\u00ecnh.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>top<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-d\u1eebng-ti\u1ebfn-trinh\"><strong>D\u1eebng ti\u1ebfn tr\u00ecnh<\/strong>\u00a0<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>kill<\/code>: d\u1eebng theo PID.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>kill 1234\nkill -9 1234   # c\u01b0\u1ee1ng b\u1ee9c (SIGKILL) \u2013 d\u00f9ng khi \u201cc\u1ee9ng \u0111\u1ea7u\u201d<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>killall<\/code>: d\u1eebng theo t\u00ean ti\u1ebfn tr\u00ecnh.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>killall nginx<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-qu\u1ea3n-ly-d\u1ecbch-v\u1ee5\"><strong>Qu\u1ea3n l\u00fd d\u1ecbch v\u1ee5<\/strong><\/h3>\n\n\n\n<p>Tu\u1ef3 distro\/h\u1ec7 th\u1ed1ng init, nh\u01b0ng ph\u1ed5 bi\u1ebfn b\u1ea1n s\u1ebd g\u1eb7p:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>service<\/code> (c\u00e1ch c\u1ed5 \u0111i\u1ec3n\/compat):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo service nginx status\nsudo service nginx restart<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>N\u1ebfu d\u00f9ng <code>systemd<\/code>, th\u01b0\u1eddng l\u00e0 systemctl (ta c\u00f3 th\u1ec3 d\u00e0nh 1 m\u1ee5c ri\u00eang trong b\u00e0i):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status nginx\nsudo systemctl restart nginx<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-thong-tin-h\u1ec7-th\u1ed1ng-amp-dung-l\u01b0\u1ee3ng\"><strong>Th\u00f4ng tin h\u1ec7 th\u1ed1ng &amp; dung l\u01b0\u1ee3ng<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>uname -a<\/code>: th\u00f4ng tin kernel\/OS.<\/li>\n\n\n\n<li><code>df -h<\/code>: dung l\u01b0\u1ee3ng c\u00e1c filesystem.<\/li>\n\n\n\n<li><code>du -sh &lt;path&gt;<\/code>: dung l\u01b0\u1ee3ng th\u01b0 m\u1ee5c (h\u1eefu \u00edch \u0111\u1ec3 t\u00ecm \u201cth\u1ee7 ph\u1ea1m\u201d \u0111\u1ea7y disk).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-command-l\u1ec7nh-v\u1ec1-m\u1ea1ng\"><span class=\"ez-toc-section\" id=\"Linux_command_Lenh_ve_mang\"><\/span><strong>Linux command: L\u1ec7nh v\u1ec1 m\u1ea1ng<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>L\u1ec7nh<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><code>ping<\/code><\/td><td>Ki\u1ec3m tra k\u1ebft n\u1ed1i m\u1ea1ng<\/td><td><code>ping google.com<\/code> &#8211; test internet<\/td><\/tr><tr><td><code>traceroute<\/code><\/td><td>Theo d\u00f5i \u0111\u01b0\u1eddng \u0111i g\u00f3i tin<\/td><td><code>traceroute google.com<\/code> &#8211; debug m\u1ea1ng<\/td><\/tr><tr><td><code>ifconfig<\/code><\/td><td>Xem c\u1ea5u h\u00ecnh m\u1ea1ng<\/td><td><code>ifconfig<\/code> &#8211; xem IP m\u00e1y<\/td><\/tr><tr><td><code>ssh<\/code><\/td><td>\u0110\u0103ng nh\u1eadp server t\u1eeb xa<\/td><td><code>ssh user@ip<\/code> &#8211; truy c\u1eadp VPS<\/td><\/tr><tr><td><code>wget<\/code><\/td><td>T\u1ea3i file t\u1eeb internet<\/td><td><code>wget url <\/code>&#8211; t\u1ea3i source\/tool<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ki\u1ec3m-tra-k\u1ebft-n\u1ed1i\"><strong>Ki\u1ec3m tra k\u1ebft n\u1ed1i<\/strong><\/h3>\n\n\n\n<p id=\"h-ki\u1ec3m-tra-k\u1ebft-n\u1ed1i-v\u1edbi-ping-xem-may-dich-co-ph\u1ea3n-h\u1ed3i-khong\">Ki\u1ec3m tra v\u1edbi ping xem m\u00e1y \u0111\u00edch c\u00f3 ph\u1ea3n h\u1ed3i kh\u00f4ng:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ping -c 4 8.8.8.8<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-trace-d\u01b0\u1eddng-di\"><strong>Trace \u0111\u01b0\u1eddng \u0111i<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>traceroute<\/code>: xem c\u00e1c \u201chop\u201d t\u1eeb m\u00e1y b\u1ea1n t\u1edbi \u0111\u00edch.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>traceroute google.com<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-xem-thong-tin-interface-ip\"><strong>Xem th\u00f4ng tin interface\/IP<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ifconfig<\/code> (tr\u00ean nhi\u1ec1u m\u00e1y m\u1edbi c\u00f3 th\u1ec3 c\u1ea7n c\u00e0i <code>net-tools<\/code> ho\u1eb7c d\u00f9ng <code>ip a<\/code>):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ifconfig<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-ssh-va-t\u1ea3i-file\"><code>ssh<\/code><strong> v\u00e0 t\u1ea3i file<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ssh<\/code>: \u0111\u0103ng nh\u1eadp m\u00e1y ch\u1ee7 t\u1eeb xa.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh user@1.2.3.4\nssh -i ~\/.ssh\/id_rsa user@1.2.3.4<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>wget<\/code>: t\u1ea3i file qua HTTP\/HTTPS.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/example.com\/file.zip<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-linux-command-l\u1ec7nh-permissions-va-ownership\"><span class=\"ez-toc-section\" id=\"Linux_command_Lenh_Permissions_va_ownership\"><\/span><strong>Linux command: L\u1ec7nh Permissions v\u00e0 ownership<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>L\u1ec7nh<\/strong><\/td><td><strong>M\u00f4 t\u1ea3<\/strong><\/td><td><strong>V\u00ed d\u1ee5<\/strong><\/td><\/tr><tr><td><code>ls -l<\/code><\/td><td>Xem quy\u1ec1n v\u00e0 owner<\/td><td><code>ls -l<\/code> &#8211; ki\u1ec3m tra quy\u1ec1n file<\/td><\/tr><tr><td><code>chmod<\/code><\/td><td>Thay \u0111\u1ed5i quy\u1ec1n truy c\u1eadp<\/td><td><code>chmod 755 script.sh<\/code> &#8211; cho ph\u00e9p ch\u1ea1y script<\/td><\/tr><tr><td><code>chown<\/code><\/td><td>Thay \u0111\u1ed5i ch\u1ee7 s\u1edf h\u1eefu<\/td><td><code>chown user:group file<\/code> &#8211; g\u00e1n owner<\/td><\/tr><tr><td><code>chgrp<\/code><\/td><td>Thay \u0111\u1ed5i group<\/td><td><code>chgrp dev app.log<\/code> &#8211; \u0111\u1ed5i group qu\u1ea3n l\u00fd<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-d\u1ecdc-output-ls-l\"><strong>\u0110\u1ecdc output <\/strong><code>ls -l<\/code><\/h3>\n\n\n\n<p>V\u00ed d\u1ee5 ta c\u00f3:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-rw-r----- 1 hung developers  1200 Jan 12 10:00 app.log<\/code><\/pre>\n\n\n\n<p>Trong \u0111\u00f3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-rw-r-----<\/code> l\u00e0 quy\u1ec1n: owner \/ group \/ others<\/li>\n\n\n\n<li><code>hung<\/code> l\u00e0 owner, developers l\u00e0 group<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-d\u1ed5i-quy\u1ec1n-chmod\"><strong>\u0110\u1ed5i quy\u1ec1n <\/strong><code>\u2013 chmod<\/code><\/h3>\n\n\n\n<p id=\"h-d\u1ed5i-quy\u1ec1n-chmod-th\u01b0\u1eddng-co-2-cach-nh\u01b0-sau\">Th\u01b0\u1eddng c\u00f3 2 c\u00e1ch nh\u01b0 sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>D\u1ea1ng s\u1ed1 (rwx = 4\/2\/1):\n<ul class=\"wp-block-list\">\n<li><code>7<\/code> = rwx, <code>6<\/code> = rw-, <code>5<\/code> = r-x, <code>4<\/code> = r&#8211;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 644 app.log      # owner rw, group r, others r\nchmod 755 script.sh    # owner rwx, group rx, others rx<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>D\u1ea1ng k\u00fd hi\u1ec7u:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod u+x script.sh    # th\u00eam quy\u1ec1n execute cho owner\nchmod g+w app.log      # th\u00eam quy\u1ec1n write cho group\nchmod o-r secret.txt   # b\u1ecf quy\u1ec1n read c\u1ee7a others<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-d\u1ed5i-ch\u1ee7-s\u1edf-h\u1eefu-chown\"><strong>\u0110\u1ed5i ch\u1ee7 s\u1edf h\u1eefu <code>- chown<\/code><\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u1ed5i owner:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown hung app.log<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u1ed5i owner v\u00e0 group:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown hung:developers app.log<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u00c1p d\u1ee5ng \u0111\u1ec7 quy cho c\u1ea3 th\u01b0 m\u1ee5c:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>udo chown -R hung:developers \/project<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-kinh-nghi\u1ec7m-s\u1eed-d\u1ee5ng-linux-command-hi\u1ec7u-qu\u1ea3\"><span class=\"ez-toc-section\" id=\"Kinh_nghiem_su_dung_Linux_command_hieu_qua\"><\/span><strong>Kinh nghi\u1ec7m s\u1eed d\u1ee5ng Linux command hi\u1ec7u qu\u1ea3<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-luon-ki\u1ec3m-tra-k\u1ef9-l\u1ec7nh-tr\u01b0\u1edbc-khi-ch\u1ea1y\"><strong>Lu\u00f4n ki\u1ec3m tra k\u1ef9 l\u1ec7nh tr\u01b0\u1edbc khi ch\u1ea1y<\/strong><\/h3>\n\n\n\n<p>Lu\u00f4n d\u00e0nh th\u1eddi gian \u0111\u1ec3 \u0111\u1ecdc l\u1ea1i l\u1ec7nh tr\u01b0\u1edbc khi th\u1ef1c thi, \u0111\u1eb7c bi\u1ec7t l\u00e0 ki\u1ec3m tra l\u1ea1i \u0111\u01b0\u1eddng d\u1eabn,\u00a0 c\u00e1c option v\u00e0 nh\u1eefng l\u1ec7nh nh\u01b0 <code>rm<\/code>, <code>mv<\/code>, <code>cp -r<\/code>, <code>chown<\/code> c\u00f3 th\u1ec3 t\u00e1c \u0111\u1ed9ng \u0111\u1ebfn nhi\u1ec1u file ho\u1eb7c c\u1ea3 th\u01b0 m\u1ee5c. M\u1ed9t c\u00e1ch an to\u00e0n l\u00e0 th\u1eed b\u1eb1ng <code>ls<\/code> ho\u1eb7c th\u00eam t\u00f9y ch\u1ecdn x\u00e1c nh\u1eadn (<code>-i<\/code>) \u0111\u1ec3 ch\u1eafc ch\u1eafn l\u1ec7nh \u0111ang nh\u1eafm \u0111\u00fang \u0111\u1ed1i t\u01b0\u1ee3ng.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -i file.txt          # H\u1ecfi tr\u01b0\u1edbc khi x\u00f3a\ncp -i source dest      # H\u1ecfi tr\u01b0\u1edbc khi ghi \u0111\u00e8\nmv -i old new          # H\u1ecfi tr\u01b0\u1edbc khi ghi \u0111\u00e8<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-h\u1ea1n-ch\u1ebf-s\u1eed-d\u1ee5ng-quy\u1ec1n-root-\u01b0u-tien-sudo-khi-c\u1ea7n-thi\u1ebft\"><strong>H\u1ea1n ch\u1ebf s\u1eed d\u1ee5ng quy\u1ec1n root, \u01b0u ti\u00ean sudo khi c\u1ea7n thi\u1ebft<\/strong><\/h3>\n\n\n\n<p>Root c\u00f3 to\u00e0n quy\u1ec1n tr\u00ean h\u1ec7 th\u1ed1ng n\u00ean m\u1ed9t sai s\u00f3t nh\u1ecf c\u0169ng c\u00f3 th\u1ec3 g\u00e2y h\u1eadu qu\u1ea3 l\u1edbn. Thay v\u00ec \u0111\u0103ng nh\u1eadp tr\u1ef1c ti\u1ebfp b\u1eb1ng root, h\u00e3y l\u00e0m vi\u1ec7c v\u1edbi user th\u01b0\u1eddng v\u00e0 ch\u1ec9 d\u00f9ng <code>sudo<\/code> cho c\u00e1c thao t\u00e1c c\u1ea7n quy\u1ec1n cao. C\u00e1ch n\u00e0y gi\u00fap gi\u1ea3m r\u1ee7i ro v\u00e0 ph\u00f9 h\u1ee3p v\u1edbi c\u00e1ch Linux \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf.<\/p>\n\n\n\n<p><strong>L\u01b0u \u00fd<\/strong>: Kh\u00f4ng bao gi\u1edd ch\u1ea1y <code>sudo rm -rf \/<\/code> ho\u1eb7c c\u00e1c l\u1ec7nh t\u01b0\u01a1ng t\u1ef1 v\u00ec c\u00f3 th\u1ec3 x\u00f3a to\u00e0n b\u1ed9 h\u1ec7 th\u1ed1ng v\u00e0 h\u00e3y lu\u00f4n ki\u1ec3m tra \u0111\u01b0\u1eddng d\u1eabn k\u1ef9 l\u01b0\u1ee1ng tr\u01b0\u1edbc khi ch\u1ea1y l\u1ec7nh v\u1edbi quy\u1ec1n root.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-th\u1ef1c-hi\u1ec7n-l\u1ec7nh-theo-t\u1eebng-b\u01b0\u1edbc-nh\u1ecf-d\u1ec5-ki\u1ec3m-soat\"><strong>Th\u1ef1c hi\u1ec7n l\u1ec7nh theo t\u1eebng b\u01b0\u1edbc nh\u1ecf, d\u1ec5 ki\u1ec3m so\u00e1t<\/strong><\/h3>\n\n\n\n<p>V\u1edbi c\u00e1c t\u00e1c v\u1ee5 ph\u1ee9c t\u1ea1p, \u0111\u1eebng v\u1ed9i ch\u1ea1y m\u1ed9t l\u1ec7nh d\u00e0i ngay t\u1eeb \u0111\u1ea7u m\u00e0 h\u00e3y chia nh\u1ecf th\u00e0nh xem d\u1eef li\u1ec7u tr\u01b0\u1edbc, l\u1ecdc th\u1eed, ki\u1ec3m tra k\u1ebft qu\u1ea3 r\u1ed3i m\u1edbi th\u1ef1c hi\u1ec7n b\u01b0\u1edbc ti\u1ebfp theo. \u0110i\u1ec1u n\u00e0y \u0111\u1eb7c bi\u1ec7t quan tr\u1ecdng khi x\u1eed l\u00fd log, file s\u1ed1 l\u01b0\u1ee3ng l\u1edbn ho\u1eb7c d\u1eef li\u1ec7u nh\u1ea1y c\u1ea3m. V\u00ed d\u1ee5:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Thay v\u00ec ch\u1ea1y ngay l\u1ec7nh d\u00e0i:\ngrep \"ERROR\" app.log | awk '{print $2}' | sort | uniq -c | sort -rn | head -10\n\n# H\u00e3y l\u00e0m t\u1eebng b\u01b0\u1edbc:\ngrep \"ERROR\" app.log                    # B\u01b0\u1edbc 1: Xem c\u00f3 bao nhi\u00eau ERROR\ngrep \"ERROR\" app.log | awk '{print $2}' # B\u01b0\u1edbc 2: Ki\u1ec3m tra c\u1ed9t 2 c\u00f3 \u0111\u00fang kh\u00f4ng\n# ... v\u00e0 ti\u1ebfp t\u1ee5c t\u1eebng b\u01b0\u1edbc<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-s\u1eed-d\u1ee5ng-pipe-va-redirect-m\u1ed9t-cach-co-ch\u1ee7-dich\"><strong>S\u1eed d\u1ee5ng pipe v\u00e0 redirect m\u1ed9t c\u00e1ch c\u00f3 ch\u1ee7 \u0111\u00edch<\/strong><\/h3>\n\n\n\n<p>Pipe (<code>|<\/code>) gi\u00fap k\u1ebft n\u1ed1i nhi\u1ec1u l\u1ec7nh v\u1edbi nhau, nh\u01b0ng c\u0169ng khi\u1ebfn l\u1ec7nh tr\u1edf n\u00ean kh\u00f3 \u0111\u1ecdc v\u00e0 kh\u00f3 debug n\u1ebfu d\u00f9ng qu\u00e1 nhi\u1ec1u. Khi redirect output ra file, h\u00e3y ph\u00e2n bi\u1ec7t r\u00f5 gi\u1eefa <code>><\/code> (ghi \u0111\u00e8) v\u00e0 <code>>><\/code> (ghi th\u00eam) \u0111\u1ec3 tr\u00e1nh m\u1ea5t d\u1eef li\u1ec7u ngo\u00e0i \u00fd mu\u1ed1n.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&gt;<\/code>: ghi \u0111\u00e8 file (overwrite) &#8211; nguy hi\u1ec3m, c\u00f3 th\u1ec3 m\u1ea5t d\u1eef li\u1ec7u c\u0169<\/li>\n\n\n\n<li><code>&gt;&gt;<\/code>: ghi th\u00eam v\u00e0o cu\u1ed1i file (append) &#8211; an to\u00e0n h\u01a1n<\/li>\n\n\n\n<li><code>&lt;<\/code>: \u0111\u1ecdc input t\u1eeb file<\/li>\n\n\n\n<li><code>2&gt;<\/code>: redirect stderr (l\u1ed7i)<\/li>\n\n\n\n<li><code>2&gt;&amp;1<\/code>: redirect stderr v\u00e0o stdout<\/li>\n<\/ul>\n\n\n\n<p>V\u00ed d\u1ee5:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls &gt; output.txt         # Ghi \u0111\u00e8 file (m\u1ea5t d\u1eef li\u1ec7u c\u0169 n\u1ebfu c\u00f3)\nls &gt;&gt; output.txt        # Ghi th\u00eam v\u00e0o cu\u1ed1i file (an to\u00e0n h\u01a1n)\ncommand 2&gt; error.log    # Ch\u1ec9 l\u01b0u l\u1ed7i v\u00e0o file\ncommand &gt; output.log 2&gt;&amp;1    # L\u01b0u c\u1ea3 output v\u00e0 l\u1ed7i v\u00e0o file<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-cau-h\u1ecfi-th\u01b0\u1eddng-g\u1eb7p-v\u1ec1-linux-command\"><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_Linux_command\"><\/span><strong>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 Linux command<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-linux-command-co-dung-d\u01b0\u1ee3c-tren-macos-khong\"><strong>Linux command c\u00f3 d\u00f9ng \u0111\u01b0\u1ee3c tr\u00ean macOS kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>C\u00f3, ph\u1ea7n l\u1edbn Linux command c\u01a1 b\u1ea3n d\u00f9ng \u0111\u01b0\u1ee3c tr\u00ean macOS v\u00ec macOS \u0111\u01b0\u1ee3c x\u00e2y d\u1ef1ng tr\u00ean n\u1ec1n t\u1ea3ng Unix (BSD). C\u00e1c l\u1ec7nh quen thu\u1ed9c nh\u01b0 <code>ls<\/code>, <code>cd<\/code>, <code>pwd<\/code>, <code>cat<\/code>, <code>grep<\/code>, <code>chmod<\/code>, <code>ssh<\/code>\u2026 \u0111\u1ec1u ho\u1ea1t \u0111\u1ed9ng t\u01b0\u01a1ng t\u1ef1 tr\u00ean macOS. Tuy nhi\u00ean, m\u1ed9t s\u1ed1 l\u1ec7nh ho\u1eb7c tu\u1ef3 ch\u1ecdn c\u00f3 th\u1ec3 kh\u00e1c nh\u1eb9 v\u1ec1 c\u00fa ph\u00e1p (v\u00ed d\u1ee5 <code>sed<\/code>, <code>ps<\/code>, <code>top<\/code>) do macOS d\u00f9ng BSD tools thay v\u00ec GNU tools.<\/p>\n\n\n\n<p>Ngo\u00e0i ra, b\u1ea1n c\u00f3 th\u1ec3 c\u00e0i th\u00eam GNU tools th\u00f4ng qua Homebrew \u0111\u1ec3 h\u00e0nh vi gi\u1ed1ng Linux h\u01a1n.<\/p>\n\n\n\n<p>V\u00ed d\u1ee5 s\u1ef1 kh\u00e1c bi\u1ec7t:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Linux (GNU):\nps aux                        # Hi\u1ec3n th\u1ecb t\u1ea5t c\u1ea3 process\nsed -i 's\/old\/new\/g' file     # S\u1eeda file t\u1ea1i ch\u1ed7\n\n# macOS (BSD):\nps aux                        # V\u1eabn d\u00f9ng \u0111\u01b0\u1ee3c\nsed -i '' 's\/old\/new\/g' file  # C\u1ea7n th\u00eam '' (empty string) sau -i<\/code><\/pre>\n\n\n\n<p>Ngo\u00e0i ra, b\u1ea1n c\u00f3 th\u1ec3 c\u00e0i th\u00eam GNU tools th\u00f4ng qua Homebrew \u0111\u1ec3 h\u00e0nh vi gi\u1ed1ng Linux h\u01a1n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew install coreutils\nbrew install gnu-sed<\/code><\/pre>\n\n\n\n<p><strong>L\u01b0u \u00fd:<\/strong> Tr\u00ean Windows, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng WSL (Windows Subsystem for Linux) \u0111\u1ec3 ch\u1ea1y Linux commands trong m\u00f4i tr\u01b0\u1eddng Linux th\u1ef1c s\u1ef1, ho\u1eb7c s\u1eed d\u1ee5ng Git Bash (m\u1ed9t ph\u1ea7n c\u1ee7a Git for Windows) \u0111\u1ec3 c\u00f3 m\u1ed9t s\u1ed1 l\u1ec7nh c\u01a1 b\u1ea3n t\u01b0\u01a1ng t\u1ef1.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-l\u1ec7nh-linux-co-gi\u1ed1ng-nhau-gi\u1eefa-cac-distro-khong\"><strong>L\u1ec7nh Linux c\u00f3 gi\u1ed1ng nhau gi\u1eefa c\u00e1c distro kh\u00f4ng?<\/strong><\/h3>\n\n\n\n<p>V\u1ec1 c\u01a1 b\u1ea3n, c\u00e1c l\u1ec7nh c\u1ed1t l\u00f5i l\u00e0 gi\u1ed1ng nhau tr\u00ean h\u1ea7u h\u1ebft c\u00e1c distro Linux v\u00ec ch\u00fang tu\u00e2n theo chu\u1ea9n POSIX. Nh\u1eefng l\u1ec7nh nh\u01b0 <code>ls<\/code>, <code>cp<\/code>, <code>mv<\/code>, <code>rm<\/code>, <code>ps<\/code>, <code>grep<\/code>, <code>chmod<\/code> g\u1ea7n nh\u01b0 kh\u00f4ng \u0111\u1ed5i. S\u1ef1 kh\u00e1c bi\u1ec7t ch\u1ee7 y\u1ebfu n\u1eb1m \u1edf tr\u00ecnh qu\u1ea3n l\u00fd g\u00f3i (<code>apt<\/code>, <code>dnf<\/code>, <code>yum<\/code>, <code>pacman<\/code>), h\u1ec7 th\u1ed1ng init (<code>systemctl<\/code> v\u1edbi <code>systemd<\/code>) v\u00e0 m\u1ed9t s\u1ed1 tu\u1ef3 ch\u1ecdn n\u00e2ng cao c\u1ee7a l\u1ec7nh.<\/p>\n\n\n\n<p>V\u00ec v\u1eady, n\u1ebfu b\u1ea1n n\u1eafm v\u1eefng command c\u01a1 b\u1ea3n, vi\u1ec7c chuy\u1ec3n gi\u1eefa c\u00e1c distro s\u1ebd kh\u00f4ng g\u1eb7p nhi\u1ec1u kh\u00f3 kh\u0103n.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-khi-nao-nen-dung-terminal-thay-vi-giao-di\u1ec7n-d\u1ed3-h\u1ecda\"><strong>Khi n\u00e0o n\u00ean d\u00f9ng terminal thay v\u00ec giao di\u1ec7n \u0111\u1ed3 h\u1ecda?<\/strong><\/h3>\n\n\n\n<p>Terminal ph\u00f9 h\u1ee3p khi b\u1ea1n c\u1ea7n thao t\u00e1c nhanh, l\u1eb7p l\u1ea1i nhi\u1ec1u l\u1ea7n, l\u00e0m vi\u1ec7c tr\u00ean server kh\u00f4ng c\u00f3 GUI ho\u1eb7c vi\u1ebft script t\u1ef1 \u0111\u1ed9ng. V\u1edbi c\u00e1c t\u00e1c v\u1ee5 qu\u1ea3n tr\u1ecb h\u1ec7 th\u1ed1ng v\u00e0 debug, command line th\u01b0\u1eddng hi\u1ec7u qu\u1ea3 h\u01a1n GUI.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-vi-sao-cung-m\u1ed9t-l\u1ec7nh-nh\u01b0ng-k\u1ebft-qu\u1ea3-tren-hai-may-l\u1ea1i-khac-nhau\"><strong>V\u00ec sao c\u00f9ng m\u1ed9t l\u1ec7nh nh\u01b0ng k\u1ebft qu\u1ea3 tr\u00ean hai m\u00e1y l\u1ea1i kh\u00e1c nhau?<\/strong><\/h3>\n\n\n\n<p>N\u1ebfu c\u00f9ng m\u1ed9t l\u1ec7nh nh\u01b0ng k\u1ebft qu\u1ea3 tr\u00ean hai m\u00e1y l\u1ea1i kh\u00e1c nhau th\u00ec nguy\u00ean nh\u00e2n th\u01b0\u1eddng do:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Kh\u00e1c distro ho\u1eb7c phi\u00ean b\u1ea3n h\u1ec7 \u0111i\u1ec1u h\u00e0nh<\/li>\n\n\n\n<li>Kh\u00e1c phi\u00ean b\u1ea3n tool (GNU vs BSD)<\/li>\n\n\n\n<li>Kh\u00e1c quy\u1ec1n user ho\u1eb7c bi\u1ebfn m\u00f4i tr\u01b0\u1eddng (<code>PATH<\/code>, <code>LANG<\/code>)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-k\u1ebft\"><span class=\"ez-toc-section\" id=\"Tong_ket\"><\/span><strong>T\u1ed5ng k\u1ebft<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Linux command kh\u00f4ng ch\u1ec9 l\u00e0 t\u1eadp h\u1ee3p c\u00e1c c\u00e2u l\u1ec7nh r\u1eddi r\u1ea1c, m\u00e0 l\u00e0 m\u1ed9t c\u00e1ch l\u00e0m vi\u1ec7c hi\u1ec7u qu\u1ea3 v\u1edbi h\u1ec7 \u0111i\u1ec1u h\u00e0nh. Khi hi\u1ec3u \u0111\u01b0\u1ee3c c\u00e1ch l\u1ec7nh \u0111\u01b0\u1ee3c shell v\u00e0 kernel x\u1eed l\u00fd, b\u1ea1n s\u1ebd s\u1eed d\u1ee5ng command-line m\u1ed9t c\u00e1ch ch\u1ee7 \u0111\u1ed9ng h\u01a1n, tr\u00e1nh \u0111\u01b0\u1ee3c nhi\u1ec1u l\u1ed7i ph\u1ed5 bi\u1ebfn v\u00e0 debug h\u1ec7 th\u1ed1ng d\u1ec5 d\u00e0ng h\u01a1n.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux command line l\u00e0 m\u1ed9t trong nh\u1eefng c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd nh\u1ea5t m\u00e0 h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux mang l\u1ea1i. Th\u00f4ng qua c\u00e1c command, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 qu\u1ea3n l\u00fd file, h\u1ec7 th\u1ed1ng, m\u1ea1ng, quy\u1ec1n truy c\u1eadp v\u00e0 t\u1ef1 \u0111\u1ed9ng h\u00f3a c\u00f4ng vi\u1ec7c m\u1ed9t c\u00e1ch nhanh ch\u00f3ng v\u00e0 ch\u00ednh x\u00e1c. \u0110\u1ecdc b\u00e0i vi\u1ebft n\u00e0y \u0111\u1ec3 hi\u1ec3u [&hellip;]<\/p>\n","protected":false},"author":209,"featured_media":95514,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-94826","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n - ITviec Blog<\/title>\n<meta name=\"description\" content=\"H\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch s\u1eed d\u1ee5ng b\u1ed9 Linux command c\u01a1 b\u1ea3n: c\u00e1ch Linux th\u1ef1c thi l\u1ec7nh, nh\u00f3m l\u1ec7nh linux k\u00e8m v\u00ed d\u1ee5.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n\" \/>\n<meta property=\"og:description\" content=\"Linux command line l\u00e0 m\u1ed9t trong nh\u1eefng c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd nh\u1ea5t m\u00e0 h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux mang l\u1ea1i. Th\u00f4ng qua c\u00e1c command, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 qu\u1ea3n l\u00fd file, h\u1ec7\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2026-04-12T11:54:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-12T11:54:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/linux-command-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"421\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"M\u1ef9 Duy\u00ean\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"M\u1ef9 Duy\u00ean\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n - ITviec Blog","description":"H\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch s\u1eed d\u1ee5ng b\u1ed9 Linux command c\u01a1 b\u1ea3n: c\u00e1ch Linux th\u1ef1c thi l\u1ec7nh, nh\u00f3m l\u1ec7nh linux k\u00e8m v\u00ed d\u1ee5.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/","og_locale":"vi_VN","og_type":"article","og_title":"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n","og_description":"Linux command line l\u00e0 m\u1ed9t trong nh\u1eefng c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd nh\u1ea5t m\u00e0 h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux mang l\u1ea1i. Th\u00f4ng qua c\u00e1c command, ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 qu\u1ea3n l\u00fd file, h\u1ec7","og_url":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2026-04-12T11:54:01+00:00","article_modified_time":"2026-04-12T11:54:03+00:00","og_image":[{"width":800,"height":421,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/linux-command-scaled.png","type":"image\/png"}],"author":"M\u1ef9 Duy\u00ean","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"M\u1ef9 Duy\u00ean","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"13 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/"},"author":{"name":"M\u1ef9 Duy\u00ean","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/73733c0725c7e39e696a896bd1abe2d7"},"headline":"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n","datePublished":"2026-04-12T11:54:01+00:00","dateModified":"2026-04-12T11:54:03+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/"},"wordCount":3323,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/linux-command-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/","url":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/","name":"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/linux-command-scaled.png","datePublished":"2026-04-12T11:54:01+00:00","dateModified":"2026-04-12T11:54:03+00:00","description":"H\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch s\u1eed d\u1ee5ng b\u1ed9 Linux command c\u01a1 b\u1ea3n: c\u00e1ch Linux th\u1ef1c thi l\u1ec7nh, nh\u00f3m l\u1ec7nh linux k\u00e8m v\u00ed d\u1ee5.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/linux-command-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2026\/04\/linux-command-scaled.png","width":800,"height":421,"caption":"l\u1ec7nh linux command - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/huong-dan-su-dung-linux-command\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Linux Command: H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng b\u1ed9 l\u1ec7nh Linux c\u01a1 b\u1ea3n"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/73733c0725c7e39e696a896bd1abe2d7","name":"M\u1ef9 Duy\u00ean","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Author_Duyen-Tran-120x120.jpg","caption":"M\u1ef9 Duy\u00ean"},"url":"https:\/\/itviec.com\/blog\/author\/my-duyen\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/94826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/209"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=94826"}],"version-history":[{"count":7,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/94826\/revisions"}],"predecessor-version":[{"id":95516,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/94826\/revisions\/95516"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/95514"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=94826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=94826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=94826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}