script命令用法详解
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td align="center" height="25"><font style="font-size:14pt" color="#02368D"><b>script命令用法详解</b></font><br></td></tr><tr><td bgcolor="#D2DEE2" height="1"><br></td></tr><tr><td bgcolor="#FFFFFF" height="1"><br></td></tr><tr><td align="center"><table style="border-collapse: collapse;word-wrap:break-word;" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td width="100%"><div style=" margin: 15px" width="100%" id="art"><span class="Apple-style-span" style="font-size: 13px; ">script<br style="font-size: 10pt; ">这个命令用来将操作的过程保存在日志中,securecrt中有设置log的功能,没想到操作系统上也可以,语法和使用都很简单:<br style="font-size: 10pt; ">语法:script [-a] [-f] [-q] [-t] <br style="font-size: 10pt; "><br style="font-size: 10pt; ">1、执行script命令<br style="font-size: 10pt; ">$ script <br style="font-size: 10pt; ">Script started, file is typescript<br style="font-size: 10pt; "><br style="font-size: 10pt; ">2、随便执行一些命令<br style="font-size: 10pt; ">$ ls <br style="font-size: 10pt; ">charge_2008 checklog dbalert.tar mysql pointcard_slave.tar.gz<br style="font-size: 10pt; ">charge_alert checklog.tar etl_daily MysqlAlert.class temp<br style="font-size: 10pt; ">charge_alert.tar checklog.tar.gz etl_daily.tar mysql_db.tar ttt.txt<br style="font-size: 10pt; ">charge_stat_for_yuhui cron_mysql ftptst.ctl mysql-standard-5.0.27-linux-i686-glibc23 typescript<br style="font-size: 10pt; ">charge_stat_for_yuhui.tar dbalert ip.txt nohup.out<br style="font-size: 10pt; ">$ w<br style="font-size: 10pt; "> 17:34:09 up 7:40, 5 users, load average: 0.01, 0.02, 0.00<br style="font-size: 10pt; ">USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br style="font-size: 10pt; ">search pts/0 203.86.63.98 9:56am 1:39 0.41s 0.04s -bash <br style="font-size: 10pt; ">zxzhai pts/2 203.86.63.98 11:37am 0.00s 0.42s 0.11s -bash <br style="font-size: 10pt; ">zxzhai pts/3 203.86.63.98 11:46am 1:58m 0.15s 0.03s ssh -p7522 192.168.160.32 -lzzx <br style="font-size: 10pt; ">search pts/4 203.86.63.98 11:57am 3:03m 0.12s 0.03s -bash <br style="font-size: 10pt; ">search pts/5 203.86.63.98 2:13pm 3:19m 0.20s 0.04s -bash <br style="font-size: 10pt; "><br style="font-size: 10pt; ">3、退出script<br style="font-size: 10pt; ">$ exit<br style="font-size: 10pt; ">exit<br style="font-size: 10pt; ">Script done, file is typescript<br style="font-size: 10pt; "><br style="font-size: 10pt; ">4、日志记录在typescript文件中<br style="font-size: 10pt; ">$ more typescript <br style="font-size: 10pt; ">Script started on Wed Jul 2 17:34:03 2008<br style="font-size: 10pt; ">$ ls <br style="font-size: 10pt; ">charge_2008 checklog dbalert.tar mysql <br style="font-size: 10pt; "> pointcard_slave.tar.gz<br style="font-size: 10pt; ">charge_alert checklog.tar etl_daily MysqlAlert.class <br style="font-size: 10pt; "> temp<br style="font-size: 10pt; ">charge_alert.tar checklog.tar.gz etl_daily.tar mysql_db.tar <br style="font-size: 10pt; "> ttt.txt<br style="font-size: 10pt; ">charge_stat_for_yuhui cron_mysql ftptst.ctl mysql-standard-5.0.27-linux-i686-glibc2<br style="font-size: 10pt; ">3 typescript<br style="font-size: 10pt; ">charge_stat_for_yuhui.tar dbalert ip.txt nohup.out<br style="font-size: 10pt; ">$ w<br style="font-size: 10pt; "> 17:34:09 up 7:40, 5 users, load average: 0.01, 0.02, 0.00<br style="font-size: 10pt; ">USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br style="font-size: 10pt; ">search pts/0 203.86.63.98 9:56am 1:39 0.41s 0.04s -bash <br style="font-size: 10pt; ">zxzhai pts/2 203.86.63.98 11:37am 0.00s 0.42s 0.11s -bash <br style="font-size: 10pt; ">zxzhai pts/3 203.86.63.98 11:46am 1:58m 0.15s 0.03s ssh -p7522 192.168.160.32 -lzzx <br style="font-size: 10pt; ">search pts/4 203.86.63.98 11:57am 3:03m 0.12s 0.03s -bash <br style="font-size: 10pt; ">search pts/5 203.86.63.98 2:13pm 3:19m 0.20s 0.04s -bash <br style="font-size: 10pt; ">$ exit<br style="font-size: 10pt; ">exit<br style="font-size: 10pt; "></span></div></td></tr></tbody></table></td></tr></tbody></table>
页:
[1]