Linux
Essential Ubuntu Basic Commands
Linux basic command များ အကြောင်းကို Ubuntu အသုံးပြုပြီး လေ့လာသွားမှာ ဖြစ်ပါတယ်။ ကျတော်ကိုယ်တိုင် Ubuntu 22.0.04 ကို စမ်းသုံးကြည့်ရင်းလေ့လာထားတာများကို noted down ချရေးထားသည်များကို မျှဝေထားတာဖြစ်ပါတယ်။
1. Open the Terminal (Shortcut Ctrl+Alt+T)
Linux command များ ရိုက်ရန် terminal/prompt ဖွင့်ရန် application icon မှ တဆင့် search box မှ terminal လို့ ရိုက်ရှာ၍သြော် လည်းကောင်း သို့မဟုတ် shortcut အနေဖြင့် Ctrl+Alt+T နှိပ်၍ ဖွင့်နိုင်သည်။
Click the Terminal prompt to make sure the cursor starts to type some command.
အခြေခံ command များစတင်ရိုက်နိုင်ရန် cursor အား prompt ပေါ်တွင် ရောက်ရှိနေကြောင်းသေချာပါစေ။ သေချာစေရန် Terminal/prompt window အား click ၍ cursor အား focus လုပ်ပါ၊ cursor လေး blink ဖြစ်နေပါက commands များရိုက်ရန် အဆင့်သင့် ဖြစ်နေပါပြီ။
2. Very basic and first command
- whoami - check user name
- pwd - print working directory
- ls - list
- cd - change directory
- cd .. - change directory to backward (upper level of current directory)
- cd home - change directory to home (your home directory in Linux system)
- cd ~ - change directory to home (your home directory in Linux system)
- cd / - root (very root level of your drive on Linus)
pwd - ယခုရောက်ရှိနေသော folder path အား စစ်ဆေးရန်
ls - folder ထဲရှိ file list ကို ပြသရန် output ထုတ်ရန်
cd - folder လမ်းကြောင်းပြောင်းရန်
cd .. - လက်ရှိနေရာမှ အပြင်ပြန်ထွက်ရန်
cd home - home directory သို့ ပြန်သွားရန်
cd ~ - home directory သို့ ပြန်သွားရန်
cd / - Linux file system ရဲ့ root directory သို့သွားရန်
3. Creating folder and file
3.1. Creating folder
- mkdir - make directory (eg. mkdir folder_name, mkdir dir1 dir2 dir3)
- mkdir dir1 dir2 dir3 (create multiple folder by one command)
- mkdir -p dir4/dir5 (create parent and sub folder by one command) note: -p mean parent
- -p character means operation or switch (-p is shortcut for parent short word)
- --parent --verbose ( can be type command like --(double hyphen) for long word)
- mkdir "another folder" - use " character to create folder name with space.
3.2. Creating files using redirection
- ls > output.txt
- cat output.txt
- echo
- echo "This is a test"
- echo "This is a test 1" > text1.txt
- echo "This is a test 2" > text2.txt
- echo "This is a test 3" > text3.txt
- cat
- cat text1.txt text2.txt text3.txt
- cat text?.txt
- cat text*.txt
- cat t* > combined.txt
- cat combined.txt
- cat t* >> combined.txt
- echo "I've appended a line" >> combined.txt
- cat combined.txt
- less combined.txt
- echo "Lower Case" > a.txt
- echo "Upper Case" > A.TXT
- echo "Mixed Case" > A.txt
4. Moving and Manipulating files
- mv combined.txt dir1
- ls dir1
- mv dir1/*
- mv combined.txt test_* dir3 dir2
- ls
- ls dir2
- mv dir2/combined.txt dir4/dir5/dir6
- ls dir2
- ls dir4/dir5/dir6
- cp dir4/dir5/dir6/combined.txt .
- ls dir4/dir5/dir6
- ls
- cp combined.txt backup_combined.txt
- ls
- mv backup_combined.txt combined_backup.txt
- ls
- mv "folder 1" folder_1
- mv "folder 2" folder_2
- mv "folder 3" folder_3
- mv "folder 4" folder_4
- mv "folder 5" folder_5
- mv "folder 6" folder_6
- ls
- rm dir4/dir5/dir6/combined.txt combined_backup.txt
- rm folder_*
- rmdir folder_*
- rm -r folder_6
- ls
5. A bit of plumbing
- wc -l combined.txt
- ls ~ > file_list.txt
- wc -l file_list.txt
- rm file_list.txt
- ls ~ | wc -l
- ls /etc|wc -l
- ls /etc|wc -l
- cat combined.txt | uniq | wc -l
- cat combined.txt | uniq | less
- man uniq
- sort combined.txt | less
- sort combined.txt | uniq | wc -l
No comments:
Post a Comment