View the commented lines of text in a config file

เราสามารถที่จะใช้คำสั่ง grep ในการช่วยดูไฟล์คอนฟิกในส่วนของข้อความที่มีที่ขึ้นต้นด้วยตัวอักษรต่างๆ เพื่อใช้ในการดูคอมเม้นต์ของไฟล์คอนฟิกนั้นๆว่าได้ทำการคอมเม้นต์อะไรบ้าง จะได้สะดวกในการค้นหาและตรวจสอบค่าคอนฟิกของเรา

รูปแบบคำสั่ง

[root@Ezylinux ~]# grep -v "^#" myfile.conf  | cat -s | less

เช่นต้องการดูคอมเม้นต์ของไฟล์คอนฟิกที่มีลักษณะการคอมเม้นต์ที่ใช้ #

[root@Ezylinux ~]# grep -v "^#" /etc/CONFIGFILE.conf | cat -s | less

หรือ ต้องการดูคอมเม้นต์ของไฟล์ sendmail.mc ให้พิมพ์

[root@Ezylinux ~]# grep -v "^dnl" /etc/mail/sendmail.mc | cat -s | less

Related posts:

  1. How to delete messages from mail queue วิธีการลบ mail ออกจาก queue ของ MTA ต่างๆ โดยสมมติว่ามี...
  2. Find Out Which RPM Installed a Specific File by rpm or yum Command การตรวจสอบว่าไฟล์หรือคำสั่งต่างๆมาจาก package ไหนบ้าง สามารถทำได้ไม่ยาก โดยจะใช้คำสั่ง rpm หรือ yum...
  3. View extended information about network connections using netstat? เราสามารถใช้คำสั่ง netstat ดูรายละเอียดต่างๆของ network ได้โดยใช้คำสั่งข้างล่างนี้ [root@example ~]# netstat...
  4. Increase the maximum file descriptors for Squid ถ้า squid คุณเกิดปัญหาหรือ error message ขึ้นว่า WARNING! Your...
  5. Red Hat 4, 5 take a very long time to boot and iostat output incorrect ปัญหาการบูตเครื่องนานหรือว่าใช้คำสั่ง iostat แล้วค่าที่แสดงผลออกมาไม่ตรงกับความเป็นจริง เช่น แสดงค่า CPU utilization มากถึง...

Both comments and pings are currently closed.

Comments are closed.