linux command

split – Linux Command คำสั่งแตก file ตามจำนวนบรรทัด

split Linux Command – split ใช้ในการแตก file ออกมาเป็น file เล็กๆหลาย file ตามจำนวนบรรทัดที่กำหนด   คำสั่ง จากตัวอย่าง file มีทั้งหมด 18 บรรทัด $ cat file 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18   1. ทำการแบ่ง file ตามจำนวนบรรทัดที่กำหนด split <filename> -l <number of line> จากตัวอย่างคือ ใส่ option -l…

Read More
linux command

sort – Linux Command คำสั่งในการจัดเรียงข้อมูล file ทีละบรรทัด

sort Linux Command – sort ใช้ในการจัดเรียงข้อมูล file ทีละบรรทัด   คำสั่ง ตัวอย่าง file test $ cat test 1,hello world 2,hi 4,how r u 6,see ya 3,what 7,bye   1. จัดเรียงข้อมูลตามตัวอักษร sort <file> $ sort test 1,hello world 2,hi 3,what 4,how r u 6,see ya 7,bye   2. จัดเรียงข้อมูลตามตัวอักษรแบบย้อนกลับ sort -r <file> $ sort -r test 7,bye 6,see…

Read More
linux command

sleep – Linux Command คำสั่งหน่วงเวลา

sleep Linux Command – sleep ใช้ในการหน่วงเวลา   คำสั่ง sleep <second> $ sleep 3 … $   โครงสร้างคำสั่ง  sleep NUMBER[SUFFIX]… sleep OPTION   รายละเอียด เป็นคำสั่งที่ใช้ในการหน่วงเวลา หน่วยเป็นวินาที Option  –help display this help and exit –version output version information and exit   กลุ่มคำสั่ง –   Reference: คำสั่ง Unix – Linux Command Linux, Unix   Author: Suphakit Annoppornchai Credit: https://saixiii.com

Read More
linux command

shutdown – Linux Command คำสั่งปิดการทำงานของระบบ

shutdown Linux Command – shutdown ใช้ในการปิดการทำงานของระบบ   คำสั่ง 1. ปิดการทำงานระบบทันที shutdown -h <minute> $ shutdown -h now or $ shutdonw -h +0   2. ปิดการทำงานระบบ พร้อมกับข้อความเตือน user shutdown -h <minute> <message> $ shutdown -h +10 “Server is going down for maintenance. Please save your work ASAP.”   โครงสร้างคำสั่ง shutdown [OPTIONS…] [TIME] [WALL…]   รายละเอียด เป็นคำสั่งที่ใช้ในการปิดการทำงานของระบบโดยสามารถระบุเวลาได้ shutdown…

Read More
linux command

seq – Linux Command คำสั่งแสดงเลข sequence number

seq Linux Command – seq ใช้ในการแสดงเลข sequence number   คำสั่ง 1. แสดงเลข sequence ที่กำหนด seq <number> $ seq 4 1 2 3 4   2. แสดงช่วงของเลข sequence ที่กำหนด seq <start number> <stop number> $ seq 10 14 10 11 12 13 14   3. แสดงช่วงของเลข sequence ที่กำหนดโดยระบุการเพิ่มแต่ละขั้น seq <start number> <increment number> <stop number> $…

Read More
linux command

sed – Linux Command คำสั่งเปลี่ยนแปลงข้อมูล text ที่มีรูปแบบซับซ้อน

sed Linux Command – sed ใช้ในการเปลี่ยนแปลงข้อมูล text ที่มีรูปแบบซับซ้อน   คำสั่ง ตัวอย่าง file1 $ cat file1 aaaaaaaaaaa bbbbbbbbbbb ccccccccccc ddddddddddd eeeeeeeeeee fffffffffff ggggggggggg   1. ใช้เพิ่มบรรทัดใหม่ทุกๆบรรทัด และเขียนลง file2 $ sed G file1 > file2 $ cat file2 |sed G aaaaaaaaaaa bbbbbbbbbbb ccccccccccc ddddddddddd eeeeeeeeeee fffffffffff ggggggggggg   2. จัดบรรทัดให้ขึ้นมาติดกันด้วย . และ space $ cat file1 | sed…

Read More
linux command

sdiff – Linux Command คำสั่งวิเคราะห์เปรียบเทียบข้อมูล file ทีละบรรทัด

sdiff Linux Command – sdiff ใช้ในการวิเคราะห์เปรียบเทียบข้อมูล file ทีละบรรทัด   คำสั่ง ตัวอย่าง file1 และ file2 ที่ทำการจัดเรียง (sort) ข้อมูลแล้ว $ cat file1.sort aaaaaaaaaaa bbbbbbbbbbb ccccccccccc ddddddddddd eeeeeeeeeee fffffffffff ggggggggggg $ cat file2.sort 22222222222 33333333333 aaaaaaaaaaa ccccccccccc ddddddddddd xxxxxxxxxxx zzzzzzzzzzz   1. เปรียบเทียบข้อมูล 2 file sdiff <file1> <file2> $ sdiff file1.sort file2.sort > 22222222222 > 33333333333 aaaaaaaaaaa aaaaaaaaaaa…

Read More
linux command

screen – Linux Command คำสั่งสร้าง session screen ขึ้นมาใหม่อีกจอ

screen Linux Command – screen ใช้ในการสร้าง session screen ขึ้นมาใหม่อีกจอ   คำสั่ง 1. สร้าง screen session $ screen or $ screen -S name   2. แยก session ออกจาก session screen ปัจจุบัน (detach) Ctl+a d $ screen -d SCREENID   3. แสดง session screen เปิดอยู่ $ screen -ls   4. กลับสู่ session screen เดิม (reattach) $ screen -r…

Read More
linux command

rsync – Linux Command คำสั่ง sync ข้อมูล file ระหว่าง server

rsync Linux Command – rsync ใช้ในการ sync ข้อมูล file ระหว่าง server   คำสั่ง rsync -t <file> <remote host>:<remote path> $ rsync -t *.txt host:backup_txt/ ทำการคัดลอกและส่ง file.txt ทั้งหมด (*.txt) ไปยัง server host (host) ใน path (backup_txt) เฉพาะ file ที่มีการแก้ไข หรือ modification time เปลี่ยน (-t)   โครงสร้างคำสั่ง  Local: rsync [OPTION…] SRC… [DEST] Access via remote shell: Pull:…

Read More
linux command

rmdir – Linux Command คำสั่งลบ directory

rmdir Linux Command – rmdir ใช้ในการลบ directory   คำสั่ง rmdir <directory> $ rmdir testdir   โครงสร้างคำสั่ง  rmdir [OPTION]… DIRECTORY…   รายละเอียด เป็นคำสั่งที่ใช้ในการลบ directory   Option  –ignore-fail-on-non-empty ignore each failure that is solely because a directory is non-empty -p, –parents remove DIRECTORY and its ancestors; e.g., ‘rmdir -p a/b/c’ is similar to ‘rmdir a/b/c a/b a’…

Read More