Output of the record screen using the script command in Linux
Source: Internet
Author: User
In Linux, use the script command to record the output of the screen-Linux Enterprise Application-Linux server application information. The following is a detailed description. We use scripts to record screen output. This is used on the Linux platform. script Commands in Solaris and AIX do not have the-f option.
-F indicates that only when the buffer zone is full can the content of the previous buffer full be displayed on another terminal. Even if an exception exits, the log can still be recorded normally. Use the script-f screen. log command.
If mkfifo screen. log is used on the first terminal (this command is generally not used) and script-f screen. log is used. Find the screen. log File on another terminal, and use tail-f screen. log to scroll out your output on the first terminal in real time.
If there is no-f, only when the buffer zone is full can the content of the previous buffer full be displayed on another terminal.
The first window:
[Root @ localhost ~] # Script-f screen. log
Script started, file is screen. log
[Root @ localhost ~] # Ls-ltr
Total 33548
-Rw-r -- 1 root 15981 Jan 10 2008 server. met0
-Rw-r -- 1 root 9347 Mar 17 2008 install. log. syslog
-Rw-r -- 1 root 53792 Mar 17 2008 install. log
Drwxr-xr-x 2 root 4096 Jun 5 20:17 result
Drwxr-xr-x 2 root 4096 Jun 6 little
Drwxr-xr-x 2 root 4096 Jun 6 22: 35 2 little
Drwxr-xr-x 2 root 4096 Jun 6 23:04 big
-Rw-r -- 1 root 1079120 Jun 18 :25 test. cap
Drwxr-xr-x 5 root 4096 Jun 30 Final
-Rw-r -- 1 root 805 Jul 2 20:15 Parser. h
-Rw-r -- 1 root 855 Jul 2 20:29 HttpDownloader. h
-Rw-r -- 1 root 2997 Jul 3 08:37 Parser. cpp
-Rw-r -- 1 root 2770 Jul 3 08:39 HttpDownloader. cpp
-Rw-r -- 1 root 32 Jul 28 16:21 HarmKeyWord. ini
-Rw-r -- 1 root 822 Jul 29 :35 queue. cap
-Rw-r -- 1 root 3112 Oct 13 20:44 manscript
-Rw-r -- 1 root 79 Oct 13 20:47 screen. log
[Root @ localhost ~] # Sdf
Bash: sdf: command not found
[Root @ localhost ~] #
[Root @ localhost ~] # W
20:48:14 up 5 days, 3 users, load average: 6.15, 2.60, 1.49
User tty from login @ IDLE JCPU PCPU WHAT
Root pts/1 172.16.15.111 54: 33 0.05 s 0.05 s-bash
Root pts/3 172.16.13.134 35.00 s 0.03 s 0.00 s tail-f screen.
Root pts/5 172.16.13.134 20:28 0.00 s 0.02 s script-f scree
[Root @ localhost ~] # Exit
Exit
Script done on Mon 13 Oct 2008 08:48:23 CST
[Root @ localhost ~] #
The second window:
[Root @ localhost ~] # Tail-f screen. log
Script started on Mon 13 Oct 2008 08:47:29 CST
[Root @ localhost ~] # Ls-ltr
Total 33548
-Rw-r -- 1 root 15981 Jan 10 2008 server. met0
-Rw-r -- 1 root 9347 Mar 17 2008 install. log. syslog
-Rw-r -- 1 root 53792 Mar 17 2008 install. log
Drwxr-xr-x 2 root 4096 Jun 5 20:17 result
Drwxr-xr-x 2 root 4096 Jun 6 little
Drwxr-xr-x 2 root 4096 Jun 6 22: 35 2 little
Drwxr-xr-x 2 root 4096 Jun 6 23:04 big
-Rw-r -- 1 root 1079120 Jun 18 :25 test. cap
Drwxr-xr-x 5 root 4096 Jun 30 Final
-Rw-r -- 1 root 805 Jul 2 20:15 Parser. h
-Rw-r -- 1 root 855 Jul 2 20:29 HttpDownloader. h
-Rw-r -- 1 root 2997 Jul 3 08:37 Parser. cpp
-Rw-r -- 1 root 2770 Jul 3 08:39 HttpDownloader. cpp
-Rw-r -- 1 root 32 Jul 28 16:21 HarmKeyWord. ini
-Rw-r -- 1 root 822 Jul 29 :35 queue. cap
-Rw-r -- 1 root 3112 Oct 13 20:44 manscript
-Rw-r -- 1 root 79 Oct 13 20:47 screen. log
[Root @ localhost ~] # Sdf
Bash: sdf: command not found
[Root @ localhost ~] #
[Root @ localhost ~] # W
20:48:14 up 5 days, 3 users, load average: 6.15, 2.60, 1.49
User tty from login @ IDLE JCPU PCPU WHAT
Root pts/1 172.16.15.111 54: 33 0.05 s 0.05 s-bash
Root pts/3 172.16.13.134 35.00 s 0.03 s 0.00 s tail-f screen.
Root pts/5 172.16.13.134 20:28 0.00 s 0.02 s script-f scree
[Root @ localhost ~] # Exit
Exit
Script done on Mon 13 Oct 2008 08:48:23 CST
[Root @ localhost ~] #
This method can also be used in teaching. The instructor uses the script command to record operation logs. The student uses the tail-f command to view the instructor's explanations in real time.
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