Chinaunix首页 | 论坛 | 博客
  • 博客访问: 648283
  • 博文数量: 139
  • 博客积分: 2655
  • 博客等级: 少校
  • 技术积分: 1723
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-02 16:03
文章分类

全部博文(139)

文章存档

2013年(2)

2011年(17)

2010年(14)

2009年(86)

2008年(20)

分类: LINUX

2008-08-10 20:07:41

screen和script以前在学校里用过一次,当时bbs上还有专门讨论此问题的帖子,今天又看到,转一下,备忘.其实还有写一些实用的命令,象expect等

在linux终端下,为方便检查操作中可能出现的错误,以及避免屏幕滚屏的限制,我们可以把操作日志记录下来。常用的工具有screen,script,以及tee等。

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

> screen -L
这里是我们的操作
> exit
结束后会生成一个类似这样的文件名: screenlog.0
> more screenlog.0
这样可以查看你刚才进行的操作,发现可能存在的问题

2. script  — make typescript of terminal session

> script
我们的操作
> exit
生成一个这样的文件:typescript
> more typescript
这里查看我们进行的操作

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

4.(x)kibitz -- allow two people to interact with one shell

发起端user1:

$kibitz -tty ttyname user2

asking linewer to type:  kibitz -5747

接收端user2:

Can we talk? Run: kibitz -5747
EOF
kibitz -5747

阅读(851) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~