在Linux上录制终端的操作
来源 http://blog.51cto.com/stuart/1831570
一、安装基础软件包
1
|
[root@
test
software]
# yum install libMagickCore libMagickWand libjpeg-turbo-devel libjpeg-turbo libpng-devel compat-glibc-headers libbsd-devel xdotool -y
|
二、安装ttyrec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
[root@
test
software]
# tar xf ttyrec-1.0.8.tar.gz
[root@
test
software]
# unzip -q ttyrec-1.0.8.RHEL5.patch.zip
[root@
test
software]
# cd ttyrec-1.0.8
[root@
test
ttyrec-1.0.8]
# patch -i ttyrec-1.0.8.RHEL5.patch //打补丁
patching
file
Makefile
patching
file
ttyrec.c
[root@
test
ttyrec-1.0.8]
# make
gcc -O2 -DHAVE_openpty -c -o ttyrec.o ttyrec.c
gcc -O2 -DHAVE_openpty -c -o io.o io.c
gcc -O2 -DHAVE_openpty -o ttyrec ttyrec.o io.o -lutil
gcc -O2 -DHAVE_openpty -c -o ttyplay.o ttyplay.c
gcc -O2 -DHAVE_openpty -o ttyplay ttyplay.o io.o
gcc -O2 -DHAVE_openpty -c -o ttytime.o ttytime.c
gcc -O2 -DHAVE_openpty -o ttytime ttytime.o io.o
[root@
test
ttyrec-1.0.8]
# ll
total 188
-rw-r--r-- 1 root root 4193 Jun 11 2006 io.c
-rw-r--r-- 1 root root 371 Jun 11 2006 io.h
-rw-r--r-- 1 root root 4256 Jul 23 04:32 io.o
-rw-r--r-- 1 root root 654 Jul 23 04:32 Makefile
-rw-r--r-- 1 root root 429 Jun 11 2006 README
-rw-r--r-- 1 root root 1588 Mar 13 2015 tty2gif.py
-rwxr-xr-x 1 root root 20327 Jul 23 09:57 ttygif
-rwxr-xr-x 1 root root 15447 Jul 23 04:32 ttyplay
-rw-r--r-- 1 root root 1128 Jun 11 2006 ttyplay.1
-rw-r--r-- 1 root root 7687 Jun 11 2006 ttyplay.c
-rw-r--r-- 1 root root 8648 Jul 23 04:32 ttyplay.o
-rwxr-xr-x 1 root root 24505 Jul 23 04:32 ttyrec
-rw-r--r-- 1 root root 1454 Jun 11 2006 ttyrec.1
-rw-r--r-- 1 root root 935 Jul 23 04:31 ttyrec-1.0.8.RHEL5.patch
-rw-r--r-- 1 root root 9789 Jul 23 04:32 ttyrec.c
-rw-r--r-- 1 root root 145 Jun 11 2006 ttyrec.h
-rw-r--r-- 1 root root 18168 Jul 23 04:32 ttyrec.o
-rw-r--r-- 1 root root 441 Jul 23 09:21 ttyrecord
-rwxr-xr-x 1 root root 9995 Jul 23 04:32 ttytime
-rw-r--r-- 1 root root 432 Jun 11 2006 ttytime.1
-rw-r--r-- 1 root root 2459 Jun 11 2006 ttytime.c
-rw-r--r-- 1 root root 2152 Jul 23 04:32 ttytime.o
[root@jrgc ttyrec-1.0.8]
# cp ttyplay ttyrec ttytime /usr/local/bin
[root@jrgc ttyrec-1.0.8]
# ttyrec //进行录制
[root@jrgc ttyrec-1.0.8]
# echo "hello,word"
hello,word
[root@jrgc ttyrec-1.0.8]
# exit //结束录制
[root@
test
ttyrec-1.0.8]
# ttyplay ttyrecord //本地播放,ttyrecord录制后默认文件,可以自定义文件
[root@
test
ttyrec-1.0.8]
# ttyrec test //自定义录制文件
[root@
test
ttyrec-1.0.8]
# ll test
-rw-r--r--. 1 root root 466 Jul 23 19:28
test
|
三、将录制文件转换成GIF
1
2
3
4
5
6
7
8
9
10
11
|
[root@
test
software]
# unzip -q seq2gif-master.zip
[root@
test
seq2gif-master]
# ./configure
[root@
test
seq2gif-master]
# make
[root@
test
seq2gif-master]
# make install
[root@
test
ttyrec-1.0.8]
# seq2gif -i ttyrecord -o tty.gif
[root@
test
ttyrec-1.0.8]
# ll tty.gif
-rw-r--r--. 1 root root 28068 Jul 23 19:31
tty
.gif
附录:
git clone https:
//github
.com
/saitoha/seq2gif
wget http:
//0xcc
.net
/ttyrec/ttyrec-1
.0.8.
tar
.gz
wget https:
//codeload
.github.com
/gist/08c41b8b16ca3b969df4/zip/62767e5f3564346394f5a21bd4fe377d2e05c51c
|
四、结果