Terminal app เป็น terminal emulator ใน macOS ให้ text-based access ไปยัง OS command line interface ตอนร่วมกับ Unix shell ช่วยทำทั้งงานปกติและซับซ้อน
ถ้าใช้ Terminal บ่อย คิดถึงการปรับแต่งลักษณะ Terminal บ้าง และเปลี่ยน properties ต่างๆ ให้มีประโยชน์มากขึ้น
ในโพสต์นี้ พูดถึงเทคนิคปรับแต่ง Terminal บน Mac และใช้ประโยชน์สูงสุด!
เปิด Terminal คลิก Go To-> Utilities บน Finder window หา Terminal คลิกเปิด

เปิด Terminal ได้ข้อมูล date และ time last login
Last login: Thu May 2 03:23:31 on ttys000
admins-Mac:~ admin$~
: – visual separator,
~ (tilde) – หมายถึงอยู่ใน home directory
Admin – short user name
$ – login เป็น non-root user

ปรับแต่ง Mac Terminal
Terminal แค่ native app ของ Mac เหมือน native apps อื่น ย้าย ขยาย ย่อ zoom scroll ได้ ถ้าทำงานบน Terminal นานหน้าต่างจะมีเนื้อหาเยอะ ข้อความมองไม่ชัด หา cursor ยาก resize หน้าต่างได้ แต่ครั้งหน้าจะเจอปัญหาเดิม เพราะการเปลี่ยนแปลงแบบนี้ไม่ถาวร
เพื่อให้การเปลี่ยนแปลงคงอยู่ ทำตามขั้นตอน:
ขั้นตอน 1: ไป Shell คลิก Show Inspector

หมายเหตุ: กด CMD และ I พร้อมกันได้ Show Inspector ถ้า Mac บน Windows ใช้ Windows key และ I
ขั้นตอน 2: คลิกแท็บ Info ใต้ Window เปลี่ยนจำนวน Rows และ Column ได้ เปลี่ยนขนาดหน้าต่างด้วยลูกศรคู่ และเห็นค่าอัตโนมัติ

ปรับ Terminal window ขนาด ตำแหน่ง รูปทรงเสร็จ คลิก Shell เลือก Use Settings as Default
เปลี่ยน Terminal Theme
เปลี่ยน Terminal theme ได้ ดีฟอลต์ ข้อความสีดำพื้นขาว แต่เปลี่ยน characteristics ต่างๆ ได้ font, color, cursor type, text color ฯลฯ
ไป Shell เลือก New Window. เปลี่ยน basic เป็น built-in themes เช่น Basic, Homebrew, Grass, Man Page, Novel, Ocean ฯลฯ

คลิก Terminal-> Preferences ใต้ Preferences เลือก Profiles

แสดงรายการ prebuilt themes พร้อม thumbnails ด้านซ้าย attributes อื่นๆ ด้านขวา

ด้านขวา มี Text, Tab, Window, Shell, Keyboard and Advanced อยากเปลี่ยนอะไร เลือก theme คลิก Settings (ไอคอนเกียร์) มุมซ้ายล่างเมนู Profiles
Text

Terminal ปรับ text attributes ได้ เปลี่ยน font คลิก Change จาก Font section เปลี่ยน typeface และ size เปลี่ยนสีข้อความ bold fonts ใช้สีสว่างสำหรับ bold text

ใช้ Opacity และ Blur ใต้ Font section ทำ Terminal window โปร่งใส ด้วย sliders พิมพ์คำสั่งบน Terminal พร้อมอ่านเว็บเพจ
เปลี่ยนรูป cursor ได้ Underline, Block, Blink Cursor and Vertical Bar เปลี่ยนสี cursor คลิกปุ่มสีข้าง Cursor
Window

แท็บ Window มี Title, Window Size, Scrollback, Resume, Minimized Windows
หมายเหตุ: การเปลี่ยนแปลงใน pane นี้ ใช้กับ profile (duplicate profile ที่สร้างหลังเลือก theme) ไม่ใช่ Terminal ตรงๆ
เปลี่ยนชื่อหน้าต่างจาก Title Field อยากแสดง Working directory หรือ document, active process, Shell command name, Profile name ให้ติ๊ก
เปลี่ยนขนาดหน้าต่าง duplicate theme ที่สร้าง ใต้ Window Size กำหนดขนาด scrollback buffer เก็บ history คำสั่งที่ใช้ Terminal สัปดาห์ก่อน

4 sections อื่นๆ ใช้ตั้งค่า เช่น set Always, Never, หรือ Only if there are processes other than the login shell ใต้ Asked before closing section on Shell tab. Select/Deselect Scroll alternate screen บน Keyboard tab ฯลฯ
Window Groups
ถ้าชอบจัด Terminal window แบบเฉพาะ ทุกครั้งก็ใช้เวลามาก ถ้าไม่ต้องจัดทุกครั้งที่เปิด Terminal เริ่มงานเลย? Window Groups ช่วยจัดการ แต่ละ Terminal window มี individual process, ตำแหน่งเฉพาะ, attributes บน Mac

วิธีนี้ รันคำสั่งต่างกันบน Terminal พร้อมกัน เพิ่มประสิทธิภาพ ช่วยตอนหน้าต่างทำงานนาน ทำงานอื่นบนหน้าต่างอื่นได้
How To Save Window Group?
ก่อนสร้าง window group ทำให้เสร็จ:
- ตัดสิน onscreen window position
- รันคำสั่งบนทุกหน้าต่างที่อยาก resume

- เปลี่ยน attributes, ขนาด, รูปทรง แต่ละหน้าต่าง
- ใต้ Window เลือก Save Windows as Group. ตั้งชื่อ Window Group คลิก Save

หมายเหตุ: อย่าลืมติ๊ก Use window group when Terminal start
ครั้งหน้าเปิด Window Group ไป Window แล้ว Open Window Group คลิกชื่อ Window Group เปิดและ resume งาน

จัดการ Window Groups จาก Terminal->Preferences

ใต้ Preferences เลือก Window Groups คลิก Settings (gear) Import/export

คลิก minus (-) ลบ Window Group ไหนก็ได้

ปรับแต่ง Mac terminal ตามชอบแล้ว เปลี่ยนขนาด สี ข้อความ พื้นหลัง สำรวจ Terminal->Preferences เพิ่มเติมได้
บทความมีประโยชน์ไหม? บอกในความคิดเห็นด้านล่าง!