ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
ip addr (ဒါမှမဟုတ် ip a) က ကိုယ့် machine ရဲ့ network interface (Wi-Fi, Ethernet) နဲ့ IP address ကို ပြပါတယ် — 'ကိုယ်ဟာ network ပေါ်မှာ ဘယ်လိုအမည်ကနေ ခေါ်ရမလဲ' ဆိုတဲ့ information ပါ။ ping <address> က target ဆီ 'ကြားလား' ဆိုပြီး packet လေးများ ပို့ကြည့်တာပါ — response ပြန်လာရင် connection ရှိကြောင်း သိရပါတယ် (Ctrl+C နဲ့ ရပ်ရပါတယ်, default က ကိုယ်တိုင်ရပ်မှ ရပ်ပါတယ်)။ curl <url> က URL တစ်ခုရဲ့ content ကို terminal ပေါ်မှာ တိုက်ရိုက် download/print လုပ်ပါတယ် — API testing, website response စစ်ဆေးဖို့ developer တွေ အများဆုံးသုံးတဲ့ tool တစ်ခုပါ။ wget <url> ကတော့ curl နဲ့ ဆင်တူပေမယ့် ဖိုင်ကို download လုပ်ဖို့ ပိုအထောက်အကူဖြစ်ပါတယ် (progress bar ပါတွဲပြပါတယ်)။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
'Server internet ချိတ်ဆက်နေလား' စစ်ချင်ရင် ping google.com ကို run ကြည့်ပါ, response reply ပြန်ဝင်ရင် connection ကောင်းနေတယ်ဆိုတာ သိရပါမယ်။ API endpoint တစ်ခု အလုပ်ဖြစ်/မဖြစ် စစ်ချင်ရင် curl https://api.example.com/status ကို run ပြီး response ကို terminal ပေါ်မှာ တိုက်ရိုက်ကြည့်လို့ရပါတယ် — Postman လို GUI tool မလိုဘဲ terminal ကနေ quick test လုပ်ချင်တဲ့အခါ curl က go-to tool ပါ။ Server ပေါ်ကို software file တစ်ခု download ချင်ရင် wget https://example.com/file.tar.gz ရိုက်ရုံပါ။
အတူတူ terminal ထဲ စမ်းမယ်
ip addr
ping google.com # Ctrl+C နဲ့ ရပ်
curl https://example.com
wget https://example.com/file.zipping google.com ကို run ရင် 'bytes from ...' စတဲ့ reply line များ အဆက်မပြတ် ပေါ်လာမည်, Ctrl+C နဲ့ ရပ်ပြီးနောက် statistics summary ပြသည်။၅ မိနစ် စမ်းကြည့်
ping google.com ကို run ပြီး ၅ ကြိမ်လောက် reply ရလာတာ ကြည့်ပြီး Ctrl+C နဲ့ ရပ်ပါ။ ပြီးရင် curl https://example.com ကို run ပြီး HTML content ထွက်လာသလား ကြည့်ပါ။
သတိလေးတစ်ချက်
wget/curl နဲ့ website တစ်ခုကို repeatedly (loop ထဲထည့်ပြီး) request ပို့ခြင်းသည် target server ကို overload ဖြစ်စေနိုင်တဲ့ အန္တရာယ်ရှိပါတယ် — ကိုယ်ပိုင်မဟုတ်တဲ့ site ပေါ်မှာ ဒီလို မလုပ်ပါနှင့်။