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