Linux script and scriptreplay(一)
来源:互联网 发布:无名的裘德 知乎 编辑:程序博客网 时间:2024/05/18 02:39
前言
偶然发现linux里面两个比较有意思的命令script和scriptreplay,其中script是用来录制命令的,scriptreplay用来重放录制文件。机器为ubuntu。
script和scriptreplay的使用
- 看一下script的帮助文档
script -hUsage: script [options] [file]Options: -a, --append append the output -c, --command <command> run command rather than interactive shell -r, --return return exit code of the child process -f, --flush run flush after each write --force use output file even when it is a link -q, --quiet be quiet -t, --timing[=<file>] output timing data to stderr (or to FILE) -V, --version output version information and exit -h, --help display this help and exit
- 使用script
script -t out.data 2>out.time#以上2>out.time表示将stderr重定向到out.time文件中#之后随意输入命令#最后输入ctrl+d退出
- scriptreplay帮助文档
scriptreplay -hUsage: scriptreplay [-t] timingfile [typescript] [divisor]Options: -t, --timing <file> script timing output file -s, --typescript <file> script terminal session output file -d, --divisor <num> speed up or slow down execution with time divisor -V, --version output version information and exit -h, --help display this help and exit
- 使用scriptreplay重放命令
scriptreplay -t out.time out.data
下载script和scriptreplay源码
- 找到script的位置
#找到script的位置which script/usr/bin/script#查看找到的文件是否是软连接,是则继续找ls -l /usr/bin/script-rwxr-xr-x 1 root root 14760 Aug 5 2015 /usr/bin/script
- 找到script属于哪个包
dpkg -S /usr/bin/scriptbsdutils: /usr/bin/script#script属于bsdutils这个包的
- 下载bsdutils源码
sudo apt-get source bsdutilsls -l #这里已经下载好了drwxr-xr-x 31 root root 4096 Apr 17 15:55 util-linux-2.20.1-rw-r--r-- 1 root root 117861 Sep 3 2015 util-linux_2.20.1-5.1ubuntu20.7.diff.gz-rw-r--r-- 1 root root 3257 Sep 3 2015 util-linux_2.20.1-5.1ubuntu20.7.dsc-rw-r--r-- 1 root root 6174190 Dec 17 2011 util-linux_2.20.1.orig.tar.gz
- 查找script所在位置
find -L util-linux-2.20.1 -name "*script*"#以下是结果,现在可以去查看相关源代码了util-linux-2.20.1/debian/README.scriptutil-linux-2.20.1/term-utils/script.cutil-linux-2.20.1/term-utils/script.1util-linux-2.20.1/term-utils/scriptreplay.cutil-linux-2.20.1/term-utils/scriptreplay.1util-linux-2.20.1/tests/expected/scriptutil-linux-2.20.1/tests/ts/script
重新编译script
- 用apt-get安装依赖
sudo apt-get build-dep bsdutils
- 编译
./configuremake
0 0
- Linux script and scriptreplay(一)
- Linux script and scriptreplay(二)
- Linux script and scriptreplay(三)
- 【linux命令】script&&scriptreplay
- 命令录制与回放:script and scriptreplay
- script scriptreplay
- linux下用script和scriptreplay对命令行操作录像
- 使用script命令记录Linux终端会话 scriptreplay回放
- linux下脚本录制工具——script和scriptreplay
- linux下用script和scriptreplay对命令行操作录像
- 脚本录制和回放终端会话(script、scriptreplay)使用
- 每日一shell之script和scriptreplay录制与回放终端会话
- linux下使用script和scriptreplay对命令行操作进行录像
- 在linux上用script和scriptreplay对命令行操作录像
- 关于脚本录制和回放终端会话(script、scriptreplay)使用
- linux command Line and shell script bible(笔记一_文档/文件系统)
- linux下shell script学习(一)
- script和scriptreplay命令实现终端录制和回放。
- 百度地图之导航
- FPGA第六篇:Verilog语法的基本概念
- 未能加载文件或程序集“MySql.Data, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d”或它的某一个依赖项
- 8天学通MongoDB——第一天 基础入门
- sso开篇
- Linux script and scriptreplay(一)
- codeforces 617E (莫队算法)
- 36. Valid Sudoku
- TCP/IP 卷一 链路层
- 科目二相关事项
- Python Logging模块-Logger,Handler,Formatter
- linux内核编程实验三
- zoj3460(二分图,拆点,二分)
- 剑指offer(旋转数组中的最小的数字)