`
wsql
  • 浏览: 11810959 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

script and scriptreplay 记录linux操作命令

 
阅读更多

我们知道:在Windows环境下可以通过一些录制屏幕的软件,把屏幕捕捉下来,如camtasia studio。当然,UNIX/Linux系统下也有相关工具可以达到这个目的,那就是scriptscriptreplay:

首先,说说script工具,默认情况下,大多数Linux系统都会自带该工具,具体用法不详细记录了。想说说的就是,比较“好玩儿”的用法:

[oracle@Oracle10g ~]$script -t 2>oracle.time -a oracle.txt

Script started, file is oracle.txt

[oracle@Oracle10g ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 – Production on Mon Apr 19 22:04:51 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn / as sysdba;

Connected.

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production

With the Partitioning, OLAP and Data Mining options

[oracle@Oracle10g ~]$ exit

Script done, file is oracle.txt

其次,再来说说scriptreplay的用法。解释一下刚才的script命令,相当于在我们的当前路径下生成了两个文件oracle.time(记录我们的命令执行的时间-t参数表示记录命令执行时间),oracle.txt记录我们所有的执行命令,包括显示在终端上的结果。当然,这两个文件的名称和路径,我们可以任意指定。那么,我们接下来就可以利用scriptreplay命令来“播放”我们刚才的执行“录像”了,只需要在命令行上执行下述命令了:

[oracle@Oracle10g ~]$scriptreplay oracle.time oracle.txt

就可以看到,我们刚才执行的所有命令流程了。

当然了,scriptreplay命令在默认情况下是不会安装的,所以我们需要做些“工作”,其实,该命令就是一个perl脚本文件。具体,下载安装过程:

①下载:http://www.filestube.com/2e12d7b3079daa5903ea/go.html

②安装:[oracle@Oracle10g ~]$tar jxvf util-linux-2.12r.tar.bz2

会在当前路径下生成名为util-linux-2.12r的路径

③配置:以root用户执行:

[root@Oracle10g oracle]#cp /u01/app/oracle/util-linux-2.12r/misc-utils/scriptreplay.pl /usr/bin/scriptreplay

最后,就可以以普通用户执行scriptreplay命令了,当然我们还可以以root用户到/usr/bin路径下去把scriptrreplay命令改为我们自己喜爱的命令名称了!不过,我们在播放“录像”的时候,要注意那两个“时间文件”和“命令文件”的顺序,不要颠倒了。

scriptreplay xx.time xx.log 3 3是速度

分享到:
评论

相关推荐

    Linker+Script+in+Linux

    Linker+Script+in+Linux Linker+Script+in+Linux Linker+Script+in+Linux Linker+Script+in+Linux Linker+Script+in+Linux Linker+Script+in+Linux

    101 shell script for linux and unix

    Wicked Cool Shell Scripts: 101 Scripts for Linux, Mac OS X, and Unix Systems <br>This cookbook of useful, customizable, and fun scripts gives you the tools to solve common Linux, Mac OS X and UNIX ...

    linux记录登录用户的详细操作

    本文档使用了两种方法来记录liunx登录用户的详细操作,综合了使用scripts 以及脚本的方法,很实用,已在实际环境中使用!

    Linux and Unix Shell Programming

    With more and more systems being run under UNIX and Linux, the ability to program and customize the shell quickly and reliably to get the best out of any individual system is becoming a more and more ...

    Linker Script in Linux(链接脚本学习)

    Linker Script in Linux(链接脚本学习) Linker Script in Linux(链接脚本学习)--

    linux全命令超详细讲解

    linux的各种命令,4万字最全讲解,包括热键,开关机,目录与文件操作,磁盘格式操作,压缩,打包,备份,vi编辑器的使用,编码操作正则表达式的基本操作,shell script操作,使用者操作,管理员操作,还包括系统备份...

    linux script 好用的sed命令

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

    通过Linux命令实现屏幕录制和回放

    平时在工作学习中如果可以录屏的话,那么在...  我们需要系统中已经安装script,scriptreplay.  比如我们可以通过如下的方式来完成。简单运行几个命令,然后通过回放来看是否能够一步一步的输出。  $ script -t 2>

    Linux shell Script

    Linux shell Script, How to write shell script in Linux system.

    LINUX SHELL SCRIPT

    LINUX 脚本编程的文档,本文件全英文的特别好用,请大家来这里下载吧。

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

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

    Linux命令大全(修改版)

    Linux命令大全(修改版)Linux命令大全(修改版)Linux命令大全(修改版)Linux命令大全(修改版)

    Linker-script-in-Linux.zip_linker script

    linux链接脚本lds解析

    Unity car racing game's script and shader file

    this is the unity car racing game script and shader zip file.

    Linux 必备指令摘要,快速找到你要的命令

    突然忘了命令名字的时候顺手查查中文意思 bash GNU Bouren-Again Shell bash shell_script cat 观看一般文本文件 cat file.txt chgrp 更改群组 chgrp groupname file chmod 更改文件权限 chmod 755 file chown 更改...

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

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

    PostScript Language Tutorial And CookBook (BlueBook)

    PostScript Language Tutorial And CookBook (BlueBook)

    script教學

    簡易script教學&linux基本指令

    util-linux-ng-2.17源码(含fdisk)

    util-linux-ng-2.17.2/misc-utils/scriptreplay.c [code] util-linux-ng-2.17.2/misc-utils/setterm.c [code] util-linux-ng-2.17.2/misc-utils/uuidd.c [code] util-linux-ng-2.17.2/misc-utils/uuidgen.c [code...

Global site tag (gtag.js) - Google Analytics