ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÈçºÎ¼Ç¼linuxÖÕ¶ËϵIJÙ×÷ÈÕÖ¾

·¢²¼Ê±¼ä:2008-03-23 10:31:00À´Ô´:ºìÁª×÷Õß:Dnirta
ÔÚlinuxÖÕ¶ËÏ£¬Îª·½±ã¼ì²é²Ù×÷ÖпÉÄܳöÏֵĴíÎó£¬ÒÔ¼°±ÜÃâÆÁÄ»¹öÆÁµÄÏÞÖÆ£¬ÎÒÃÇ¿ÉÒ԰ѲÙ×÷ÈÕÖ¾¼Ç¼ÏÂÀ´¡£³£ÓõŤ¾ßÓÐscreen,script£¬ÒÔ¼°teeµÈ¡£

1. screen -- screen manager with VT100/ANSI terminal emulatio

> screen -L
ÕâÀïÊÇÎÒÃǵIJÙ×÷
> exit
½áÊøºó»áÉú³ÉÒ»¸öÀàËÆÕâÑùµÄÎļþÃû: screenlog.0
> more screenlog.0
ÕâÑù¿ÉÒԲ鿴Äã¸Õ²Å½øÐеIJÙ×÷£¬·¢ÏÖ¿ÉÄÜ´æÔÚµÄÎÊÌâ

2. script -- make typescript of terminal session

> script
ÎÒÃǵIJÙ×÷
> exit
Éú³ÉÒ»¸öÕâÑùµÄÎļþ£ºtypescript
> more typescript
ÕâÀï²é¿´ÎÒÃǽøÐеIJÙ×÷

3. tee -- read from standard input and write to standard output and files

Õâ¸öÃüÁî¿ÉÒÔ¶ÁÈ¡ÖÕ¶ËÊäÈëÊä³öµ½Öն˻òÕßÎļþÖУ¬ÓÐʱºò¿ÉÒÔÓÃÀ´¼Ç¼makeµÈÃüÁî¿ÉÄܲúÉúµÄÊä³öµ½Öն˵ĴóÁ¿ÄÚÈÝÊä³öµ½ÎļþÖÐÈ¥¡£ÕâÑù¿ÉÒÔ·½±ã¼Ç¼ÕâЩÃüÁîµÄÈÕÖ¾¡£

> make 2>&1 | tee make.log
µ±È»£¬ÎÒÃÇÒ²¿ÉÒÔÖ±½ÓÖض¨Ïòµ½Ò»¸öÎļþÖÐ
> make > make.log

PS: 2>&1ÊÇΪÁ˼Ǽ´íÎóÈÕÖ¾
if you want to filter the control symbols, try to use the "col" command like this:

$ cat screenlog.0 | col -b > screenlog

or

$ cat typescript | col -b > scriptlog
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. Ä̲èdsk ÓÚ 2008-03-23 12:49:42·¢±í:

    ѧϰÁË...