Linux Essential commands (Part-1)


ဒီနေ့မှာတော့ ကျွန်တော်က Linux မှာအသုံးများပြီး beginner တစ်ယောက်အနေနဲ့ သိကိုသိသင့်တယ်ထင်တဲ့ commands တွေအကြောင်းရေးသွားပါမယ်။
မှတ်သားစရာ တစ်ခုရှိတာက Linux မှာ commands တွေရိုက်ရင် case sensitive ဖြစ်ပါတယ်။ ဥပမာ cd command ကို CD လို့ရိုက်ရင် Linux က execute လုပ်နိုင်မှာမဟုတ်ပါဘူး။
𝐩𝐰𝐝 ( 𝐏𝐫𝐞𝐬𝐞𝐧𝐭 𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐃𝐢𝐫𝐞𝐜𝐭𝐨𝐫𝐲 )
ဒီ command ကတော့ Linux မှာ ကျွန်တော်တို့လက်ရှိ ရောက်နေတဲ့ Directory ကိုပြပေးတာပါ။ e.g. ကိုယ်က /home အောက်မှာလား ဆိုတာမျိုးပေါ့။ Default အနေနဲ့ user တစ်ယောက် login ဝင်ပြီးရင် /home/{your-user-name} အောက်မှာရောက်နေပါလိမ့်မယ်။
𝐜𝐝 ( 𝐂𝐡𝐚𝐧𝐠𝐞 𝐝𝐢𝐫𝐞𝐜𝐭𝐨𝐫𝐲 )
ဒီ command ကတော့ နေ့စဥ်နေ့တိုင်း သုံးရမယ့် command ဖြစ်ပြီး CLI စသုံးမယ်ဆို သိသင့်ပါတယ်။ သူကဘာလုပ်ပေးလဲ ဆိုတော့ ကိုယ်သွားချင်တဲ့ Directory ကိုသွားတဲ့ နေရာမှာသုံးပါတယ်။
E.g. cd /home/, cd /etc/ စသဖြင့်ကိုယ်သွားချင်တဲ့ နေရာကို cd ရဲ့နောက်မှာ ထည့်ပြီးသုံးနိုင်ပါတယ်။
𝐰𝐡𝐨𝐚𝐦𝐢
ပြောရရင် Linux ရဲ့ command တွေက အရမ်း relatable ဖြစ်ပါတယ်။ သူပေးထားတဲ့ နာမည်နဲ့ လုပ်ပေးတဲ့အလုပ်နဲ့ကို ဆက်ဆက်တွေးကြည့်လို့ရပါတယ်။ ဒီ command ဆိုရင်တော့ ကိုယ်က ဘယ် username နဲ့ system ထဲမှာ log in ဝင်ထားလည်းဆိုတာကိုပြပေးမှာပါ။
𝐰𝐡𝐨
ဒီ command ကတော့ ကိုယ့်ရဲ့ system မှာ လက်ရှိ ဘယ် users တွေ logged in ဖြစ်နေလဲဆိုတာကို ပြပေးတဲ့ command ပဲဖြစ်ပါတယ်။ သူ့ကို options ဘာမှမထည့်ပဲ ရိုက်လိုက်ရင် logged in ဖြစ်နေတဲ့ username ရယ်၊ စစချင်း logged in ဝင်ထားတဲ့ time ရယ်၊ နောက်ပြီး ဘယ် ip ကနေ logged in ဝင်ထားတယ် ဆိုတာတွေကြည့်လို့ရမှာပဲ ဖြစ်ပါတယ်။
နောက်ပြီး ကိုယ်ရဲ့ system ဘယ် run level နဲ့ run နေလည်းကြည့်ချင်ရင်လည်း 𝐰𝐡𝐨 -𝐫 ဆိုပြီးကြည့်လို့ရပါတယ်။ run level တွေအကြောင်းတော့နောက်မှ သပ်သပ်ထပ်ရေး ပါဦးမယ်။
𝐦𝐤𝐝𝐢𝐫 ( 𝐌𝐚𝐤𝐞 𝐃𝐢𝐫𝐞𝐜𝐭𝐨𝐫𝐲 )
ဒီ command မှာဆိုရင်လည်း သူ့ရဲ့ နာမည်အတိုင်းပဲ၊ ကိုယ်က directory အသစ်တစ်ခု ဆောက်ချင်တဲ့ အချိန်မျိုးမှာ သုံးပါတယ်။
E.g. 𝐦𝐤𝐝𝐢𝐫 /𝐭𝐞𝐬𝐭 ဆိုပြီးသုံးလို့ရပါတယ်။
ဒီ command မှာ ကျွန်တော်အသုံးများတဲ့ option ကတော့ -p ပါ။ ဒီ option ထည့်သုံးရင် ကိုယ်က directory ဆောက်တဲ့နေရာမှာ parent directory မရှိသေးလည်း သူ့ဘာသာ ဆောက်ပေးသွားမှာဖြစ်ပါတယ်။
E.g. 𝐦𝐤𝐝𝐢𝐫 -𝐩 /𝐭𝐞𝐬𝐭/𝐡𝐡𝐰 ဆိုပြီး တစ်ခါထဲဆောက်သွားလို့ရမှာပါ။
𝐭𝐨𝐮𝐜𝐡
ဒီ command ကတော့ ကျွန်တော်တို့ windows မှာဆို new file ဆောက်တာနဲ့ ပုံစံတူပါတယ်။ ဘာ data မှမပါတဲ့ file အလွတ်လေးတစ်ခုပေါ့၊ အဲ့မှာမှ ကိုယ်ကြိုက်တဲ့ text editor လေးတစ်ခုခု သုံးပြီး ဝင် edit လုပ်လို့ရပါတယ်။
E.g. 𝐭𝐨𝐮𝐜𝐡 𝐭𝐞𝐬𝐭𝐟𝐢𝐥𝐞.𝐭𝐱𝐭 ဆိုပြီး file အသစ်လေးတစ်ခု create လုပ်လို့ရပါတယ်။
𝐥𝐬 ( 𝐥𝐢𝐬𝐭 )
ဒီ ls command ကတော့ Linux CLI သုံးတယ်ဆို မဖြစ်မနေ အမြဲရိုက်နေရမယ့် command လို့ပြောလို့ရပါတယ်။ သူကဘာလုပ်ပေးတာလဲ ဆိုတော့ directory တစ်ခုထဲမှာ ကိုယ်ကရောက်နေပြီး ဒီ directory မှာဘာ files တွေရှိလဲဆိုတာကို list လုပ်ပေးတာပဲ ဖြစ်ပါတယ်။ သူ့မှာတော့ အသုံးဝင်တဲ့ options တွေအများကြီးရှိပြီး အနည်းငယ်ကို mention လုပ်သွားပါမယ်။
E.g.1. 𝐥𝐬 ဆိုပြီး ဒီတိုင်းပဲရိုက်ရင် Directory မှာရှိတဲ့ သာမန် files တွေပဲတွေ့ရမှာဖြစ်ပြီး 𝐥𝐬 -𝐚 ဆိုပြီး option ထည့်သုံးရင်တော့ file names မှာ (.) နဲ့စတဲ့ files တွေ directories တွေပါ listing လုပ်ပေးမှာပါ။
E.g.2. 𝐥𝐬 -𝐥 ဆိုတဲ့ option နဲ့သုံးရင်တော့ long listing format နဲ့ပြမှာဖြစ်ပြီး ဒီ files တွေ directories တွေရဲ့ types တွေ file permissions တွေ file owners တွေကိုပါ ကြည့်လို့ရမှာပါ။
E.g.3. 𝐥𝐬 -𝐫 ဆိုတဲ့ option နဲ့တွဲသုံးရင်တော့ ကိုယ်လက်ရှိရောက်နေတဲ့ directory အောက်က ရှိနေတဲ့ directories တွေမှာပါ ဘာ files တွေရှိနေတယ်ဆိုတာကို recursively ပြပေးမှာဖြစ်ပါတယ်။
Linux မှာ command တွေသုံးတဲ့အခါ options ကို တစ်ခုထပ်မကလည်း သုံးလို့ရပါတယ်။
E.g. 𝐥𝐬 -𝐚𝐥 ဆိုရင် (.) နဲ့စတဲ့ files တွေရော ကျန် files တွေအကုန်လုံးကိုပါ long listing အနေနဲ့ ပြပေးမှာပါ။
𝐔𝐬𝐚𝐠𝐞 ကြည့်ခြင်း
နောက်ဆုံးအနေနဲ့ ထည့်သွင်းပြောချင်တာကတော့ ကိုယ်က Command တစ်ခုခု သုံးနေရင်းက ဘယ် options တွေရှိလဲ ကြည့်ချင်တယ်ဆို အလွယ်ဆုံးအနေနဲ့ command နောက်မှာ --help ဆိုတဲ့ options ထည့်ပြီးကြည့်လို့ရပါတယ်။ အဲ့မှာ ဒီ command ရဲ့ usage ဘယ်လိုတွေသုံးလို့ရလဲ ဆိုတာကိုလည်းပြပေးထားပါတယ်။ ကိုယ်က သူပြတဲ့ format ကိုနားလည်ဖို့တော့ လိုတာပေါ့၊ အဲ့ format ဘယ်လိုကြည့်ရမလဲ ဆိုတာလည်း နောက်နေ့မှာ screenshot လေးထည့်ပြီး ပြောသွားပါမယ်။ နောက်ပြီး Linux မှာ default ပါတဲ့ documentation တွေဘယ်လိုရှာရမလဲ ဆိုတာတွေရောပါ။
Subscribe to my newsletter
Read articles from Hein Htet Win directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Hein Htet Win
Hein Htet Win
I am a DevOps Engineer from Yangon, Myanmar. I fell in love with automation and CI/CD. I also enjoy using open-source software and regularly contribute to and participate on webinars. In my spare time, I enjoy playing games with my friends in addition to my job.