Linux script (Record) command

Source: Internet
Author: User

There are third-party tools available on the market: the Magic Fortress Machine, which has a recording using the user's operation recorded video, there is similar to the wonderful.

Linux has a script tool that specifically records all input and output results from a terminal session and stores it in the specified file. Let's see how to record it first!

1. Create Log storage Directory

# Mkdir/opt/operation_log
# chmod 777-r/opt/operation_log

2. Set up automatic recording after user login

# Vi/etc/profile #末尾追加一下内容
If [$UID-ge 500]; Then
EXEC script-t 2>/opt/operation_log/$USER-$UID-' date +%f-%t '. Date-a-q-f/opt/operation_log/$USER-$UID-' date +%f-% T '. Log
Fi
# Source/etc/profile #刷新生效

Parameter description:

-T: Record operation timing,2> The timing of the output to the specified file, using this time file for playback

-A: The output is appended to the file

-Q: Silent start

-F: Refresh output after each write

3. View the generated files

# ll/opt/operation_log/
Total 8
-rw-rw-r--1 Test test 124 Jul 3 07:17 test-1001-2015-07-03-07:17:36.date
-rw-rw-r--1 Test test 167 Jul 3 07:17 Test-1001-2015-07-03-07:17:36.log

4. Play User Action

Logging more than a long time, with more or cat view is more laborious, then there is a corresponding tool called Scriptrelay, by combining script output of the timing file, can be automatically played.

Scriptreplay test-1001-2015-07-03-07:17:36.date Test-1001-2015-07-03-07:17:36.lo


If you simply record this operation command, you can run it directly:

# Script Test

Will switch to script, wait until you finish the command, enter exit to exit, and then view the test file.



This article is from the "North Ice--q" blog, please be sure to keep this source http://beibing.blog.51cto.com/10693373/1895339

Linux script (Record) command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.