注册会员
×

已有账号? 请点击

使用其他方式登录

HTML源码网

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

发布时间:2020-07-06 09:21:44 浏览量:827 来源:测速网

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

在下述语法中,输出文件是用于存储所有的上机会话过程。如果未指定输出文件,所有的会话过程将会写到当前工作目录的默认文件typescript中。

语法格式:script [参数] [文件]

常用参数:

-a 把会话记录附加到typescript文件或指定的文件后面,保留先前的内容
-c 运行指定的命令而非交互shell
-q 安静运行模式

参考实例

一个简单的会话过程记录:

[root@linuxcool ~]# script
 Script started, file is typescript
[root@linuxcool ~]# date
 Mon Sep 23 21:07:14 CST 2019
[root@linuxcool ~]# uname -r
 3.10.0-123.el7.x86_64
[root@linuxcool ~]# exit
 exit
 Script done, file is typescript
[root@linuxcool ~]# cat typescript
 Script started on Mon 23 Sep 2019 09:07:09 PM CST
[root@linuxcool ~]# date
 Mon Sep 23 21:07:14 CST 2019
[root@linuxcool ~]# uname -r
 3.10.0-123.el7.x86_64
[root@linuxcool ~]# exit
 exit
 Script done on Mon 23 Sep 2019 09:07:23 PM CST

Linux命令行大全

在线工具导航

×
  • 微信支付
  • 支付宝付款
微信扫码支付
微信扫码支付
请使用微信描二维码支付
×

提示信息

关注公众号

微信扫码
微信扫码关注公众号后可使用