linux command

sum – Linux Command คำสั่งการตรวจสอบ checksum และ ขนาด block

sum Linux Command – sum ใช้ในการตรวจสอบ checksum และ ขนาด block   คำสั่ง sum $ sum test 22588 12 ผลลัพธ์ที่ได้คือ checksum และ block   โครงสร้างคำสั่ง  sum [OPTION]… [FILE]…   รายละเอียด เป็นคำสั่งที่ใช้ในการตรวจสอบ checksum และ ขนาด block คล้าย cksum   Option  -r use BSD sum algorithm, use 1K blocks -s, –sysv use System V sum algorithm, use 512 bytes…

Read More
linux command

su – Linux Command คำสั่ง login ด้วย user id อื่น

su Linux Command – su ใช้ในการ login ด้วย user id อื่น   คำสั่ง su – <username> $ su – staff password: <staff>$   โครงสร้างคำสั่ง  su [options] [username]   รายละเอียด เป็นคำสั่งที่ใช้ในการ login ด้วย user id อื่น โดยการสร้าง login session ใหม่หลังจาก ระบุ username ด้วยคำสั่ง su <username> ต้องทำการกรอก password ให้ถูกต้อง แต่สำหรับ session ที่เป็น user root อยู่แล้ว ไม่จำเป็นต้องกรอก password สำหรับการ su ไป…

Read More
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