`
haierboos
  • 浏览: 439557 次
文章分类
社区版块
存档分类
最新评论

script命令

阅读更多

script命令最近用的较多,感觉蛮不错。script是将终端的会话过程录制下来的小工具,你在终端中的所有操作过程,都可以原原本本地进行录制。

先man一下:

SCRIPT(1) BSD General Commands Manual SCRIPT(1)

NAME
script - make typescript of terminal session

SYNOPSIS
script [-a] [-c COMMAND] [-f] [-q] [-t] [file]

DESCRIPTION
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).

If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the
file typescript.

Options:

-a Append the output to file or typescript, retaining the prior contents.

-c COMMAND
Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a pro-
gram that behaves differently when its stdout is not a tty.

-f Flush output after each write. This is nice for telecooperation: One person does 'mkfifo foo; script -f foo' and
another can supervise real-time what is being done using 'cat foo'.

-q Be quiet.

-t Output timeing data to standard error. This data contains two fields, separated by a space. The first field indi-
cates how much time elapsed since the previous output. The second field indicates how many characters were output
this time. This information can be used to replay typescripts with realistic typing and output delays.

The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if
ignoreeof is not set) for the C-shell, csh(1)).

Certain interactive commands, such as vi(1), create garbage in the typescript file. Script works best with commands that do
not manipulate the screen, the results are meant to emulate a hardcopy terminal.

ENVIRONMENT
The following environment variable is utilized by script:

SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is
assumed. (Most shells set this variable automatically).

SEE ALSO
csh(1) (for the history mechanism), replay(1).

HISTORY
The script command appeared in 3.0BSD.

BUGS
Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.

Linux July 30, 2000 Linux

用法:

script -a filename1 -t 2>filename2

退出命令:exit

若要察看记录结果,用cat filename即可

-a 用于将记录append到文件filename1,若不用则覆盖

-t可以记录每次敲击键盘的cpu时间,蛮有用的。比如做批处理等,通过察看filename2找到两次间隔时间很大的就可是作业执行的准确时间

filename1 filename2可以是同一个文件。

以上仅限于使用经验,对man没有深究,若有更好的使用方法,请高手不吝指教,呵呵

分享到:
评论

相关推荐

    script命令 记录终端交互会话过程

    script命令可以用作交互终端会话过程的记录,保留用户输入和系统输出的全过程。以备之后查询与学习,对于初学者、保留工作记录和准备写材料的人而言,这是一个非常有用的工具 在下述语法中,输出文件是用于存储所有...

    Unix 命令全集

    script 命令 sdiff 命令 secldapclntd 守护进程 sectoldif 命令 securetcpip 命令 sed 命令 send 命令 sendbug 命令 sendmail 命令 setclock 命令 setgroups 命令 setmaps 命令 setsenv 命令 settime 命令 setuname ...

    npm script命令同时进行多个监听服务的方法

    主要介绍了npm script命令同时进行多个监听服务的方法,非常不错,具有一定的参考借鉴价值,需要的朋友参考下吧

    Linux的script命令——隐藏在终端的记录器

    当你在终端或控制台上工作时,你可能想记录下自己做了些什么。这种记录可以看成是保存了终端痕迹的文档。假设你跟一些Linux管理员同时在系统上干活。或者说你让别人远程到你的...要实现它,你可以使用script命令。

    Spotify-AppleScript-Patch:修补 Spotify 1.0.1 以上版本以重新启用对 AppleScript 命令的支持

    修补 Spotify 1.0.1 以上版本以重新启用对 AppleScript 命令的支持。 安装 用法 贡献 分叉它( ) 创建您的功能分支( git checkout -b my-new-feature ) 提交您的更改( git commit -am 'Add some feature' ) ...

    用 npm script 打造超溜的前端工作流

    1入门篇 01:创建并运行 npm script 命令.md 2入门篇 02:运行多个 npm script 的各种姿势.md 3入门篇 03:给 npm script 传递参数和添加注释.md 4进阶篇 01:使用 npm script 的钩子.md 5进阶篇 02:在 npm ...

    Acrobat Distiller 5.0.part1

    它可以通过OLE(对象链接和嵌入)或Postscript命令来控制。用Acrobat Distiller制作的PDF文件保留了源文件中全部内容,包括其中的格式、图形和影像。这种转换的效果比通过打印转换的效果好。PDF 文件比Postscript 文件...

    scriptreplay_web:简单的localweb查看器,用于通过`script`命令生成的控制台重播

    简单的本地/ Web查看器,用于由script命令生成的控制台重播。 派生自但 带有文件选择界面 没有任何服务器端代码 因此,您可以轻松使用重播,而无需担心暴露的秘密密码。 如果要设置任何Intranet共享,可以随意...

    docker-script:一行生成并运行Dockerfile

    通过docker docker script命令从Dockerfile构建映像并运行容器 基本用法 docker script from ubuntu “来自ubuntu”是有效的Dockerfile; 因此,此命令运行一个包含最新Ubuntu版本映像的容器,并将tty附加到该映像...

    PostgreSQL 8.3 数据库文档

    PostgreSQL的异步复制支持一个主节点和多个从节点的复制模式。主节点可以将数据复制到多个从节点中。理论上一个主节点带的从节点的个数是没有上限的,但从节点的个数越多,主...2.4.25节对EXECUTE SCRIPT命令的介绍)。

    linux script 好用的sed命令

    sed 命令的詳細解說與範例 看了後 馬上就會把sed用得很好

    hello-world-native-script:测试原生脚本

    你好世界本地脚本测试本机脚本。

    Bash 新手指南, 命令及shell script

    bash 的命令,及shell script的语法。由基础到深入,比较适合初学者

    Allegro教程

    4.4 File/Script 命令.............................................................................4-4 4.5 Edit/Move 命令............................................................................4-7 ...

    AppleScript初学者

    AppleScript初学者关于Apple...第一节 对象、属性和命令! 第二节 标识符和关键字! 第三节 数据类型! 第四节 强制数据类型转换! 第五节 运算符! 第六节 提取对象中的元素! 第七节 添加注释和括号! 第八节 代码缩写!

    Script.NET脚本语言开发平台

    9、Script.NET作为一个通用平台对外提供了很多接口,可以通过脚本等方式调用平台的各种功能,其中的tcl语言支持很多平台扩展命令,可以通过tcl操纵平台的各种功能,对平台进行扩展; 10、封装的TclFace页面...

    Linux指令一周通 (技术图书大系).azw3

    2.21 sed指令:利用script命令处理文本文件 2.22 sort指令:将文本文件内容加以排序 2.23 spell指令:拼字检查程序 2.24 tr指令:转换文件中的字符 2.25 uniq指令:检查文件中重复出现的行 2.26 vi指令:文字编辑器 ...

    java script 调试工具 脚本控制台

    < SCRIPT LANGUAGE="JavaScript" src="debug.js">< /SCRIPT> < SCRIPT LANGUAGE="JavaScript"> var s = "string"; out.print(s); < /SCRIPT> 详细参考:hidden.html 2,通过控制台查看目的网页的DOM文...

    Tcl开发包 for Script.NET V2.1.1

    9、Script.NET作为一个通用平台对外提供了很多接口,可以通过脚本等方式调用平台的各种功能,其中的tcl语言支持很多平台扩展命令,可以通过tcl操纵平台的各种功能,对平台进行扩展; 10、封装的TclFace页面扩展包,...

    Script.NET python 开发包

    Script.NET作为一个通用平台对外提供了很多接口,可以通过脚本等方式调用平台的各种功能,其中的tcl语言支持很多平台扩展命令,可以通过tcl操纵平台的各种功能,对平台进行扩展; 封装的TclFace页面扩展包,可以...

Global site tag (gtag.js) - Google Analytics