Records a Shell Session in Unix System
The script utility records all or part of a login session, including your input and the system’s response. It has its advantages. For example, when you
1 | cat |
a file that has captured a
1 | vim |
session, the session quickly passes before you eyes. By default script captures the session in a file named
1 | typescript |
which will contains all the inputs and outputs, which then let you to edit it as you wish in the future.
ss@notebook /home/ss
$ script
Script started, file is typescript
ss@notebook /home/ss
$ whoami
ss
ss@notebook /home/ss
$ ls -l /bin | head -5
total 5456
-rwxr-xr-x 1 root root 875596 2009-09-14 06:09 bash
-rwxr-xr-x 1 root root 30192 2009-06-30 01:18 bunzip2
-rwxr-xr-x 1 root root 30192 2009-06-30 01:18 bzcat
lrwxrwxrwx 1 root root 6 2009-12-03 22:48 bzcmp -> bzdiff
ss@notebook /home/ss
$ exit
exit
Script done, file is typescript
use the
1 | exit |
command to terminate a script session. You can then view the file you created with
1 | cat |
,
1 | less |
,
1 | more |
, or an edit.
ss@notebook /home/ss
$ gedit typescript

