Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

ติดตั้งและใช้ Command Line Cheat Sheets บน Ubuntu


Cheat คือเครื่องมือบรรทัดคำสั่งที่พัฒนาด้วย Python ให้ System Admins ดูและบันทึก cheat sheets แสดงตัวอย่างคำสั่งแบบข้อความง่ายๆ เหมาะสำหรับ "คำสั่งที่ใช้บ่อยแต่จำไม่ได้"

การติดตั้ง Cheat

  1. อัปเดตระบบ: sudo apt-get update && sudo apt-get upgrade
  2. ติดตั้ง pip: sudo apt-get install python-pip
  3. ติดตั้ง cheat: sudo pip install cheat

ตรวจสอบการติดตั้ง

$ cheat -v
cheat 2.1.24

ตั้งค่า Text Editor

$ export EDITOR=/usr/bin/vim
# ทำให้ถาวรเพิ่มใน ~/.bashrc
$ nano ~/.bashrc
# เพิ่มบรรทัด: export EDITOR=/usr/bin/vim

การใช้งาน Cheat

ดู cheat sheet คำสั่ง (เช่น tail)

$ cheat tail
# To show the last 10 lines of file: tail file
# To show the last N lines: tail -n N file
# To follow file: tail -f file

ดูรายการ cheat sheets ทั้งหมด

$ cheat -l

สร้าง/แก้ไข cheat sheet เอง

$ cheat -e tutorialspoint

ค้นหา cheat sheet

$ cheat -s tail

หมายเหตุ: บทความใช้ Python 2/pip ปัจจุบันใช้ pip3 install cheat