scriptคุณสามารถใช้ โดยทั่วไปจะบันทึกทุกอย่างที่พิมพ์บนเทอร์มินัลในscriptเซสชันนั้น
จากman script:
script makes a typescript of everything printed on your terminal.
It is useful for students who need a hardcopy record of an
interactive session as proof of an assignment, as the typescript file
can be printed out later with lpr(1).
คุณสามารถเริ่มscriptเซสชันได้โดยพิมพ์scriptเทอร์มินัลคำสั่งที่ตามมาทั้งหมดและเอาต์พุตของพวกเขาจะถูกบันทึกไว้ในไฟล์ที่มีชื่อtypescriptในไดเรกทอรีปัจจุบัน คุณสามารถบันทึกผลลัพธ์ไปยังไฟล์อื่นได้เช่นกันโดยเริ่มต้นscriptเช่น:
script output.txt
ออกจากระบบของscreenเซสชั่น (หยุดการบันทึกเนื้อหา) exitเพียงพิมพ์
นี่คือตัวอย่าง:
$ script output.txt
Script started, file is output.txt
$ ls
output.txt testfile.txt foo.txt
$ exit
exit
Script done, file is output.txt
ตอนนี้ถ้าฉันอ่านไฟล์:
$ cat output.txt
Script started on Mon 20 Apr 2015 08:00:14 AM BDT
$ ls
output.txt testfile.txt foo.txt
$ exit
exit
Script done on Mon 20 Apr 2015 08:00:21 AM BDT
scriptนอกจากนี้ยังมีตัวเลือกมากมายเช่นการทำงานอย่างเงียบ ๆ-q( --quiet) โดยไม่แสดง / บันทึกข้อความของโปรแกรมมันสามารถเรียกใช้คำสั่งเฉพาะ-c( --command) แทนที่จะใช้เซสชั่น แต่ก็มีตัวเลือกอื่น ๆ อีกมากมาย ตรวจสอบman scriptเพื่อรับแนวคิดเพิ่มเติม