We can record and reply a terminal session with script command and reply it with scriptreply command.
Here is the example to record the session:
$ script -t 2> time.txt -a session1.txt
Output:
Script started, file is session.txt
Now you can start typing some commands.
$ date
$ echo "Hi Linux"
$ time
$ ifconfig
$ ls
To stop recording run exit command.
$ exit
In above session we ran date,echo,time,ifconfig,ls commands, and stored output in time.txt and session1.txt
To replay recorded session use scriptreplay as shown below:
$ scriptreplay time.txt session1.txt
It will replay whole session that we recorded by you.
Here is the example to record the session:
$ script -t 2> time.txt -a session1.txt
Output:
Script started, file is session.txt
Now you can start typing some commands.
$ date
$ echo "Hi Linux"
$ time
$ ifconfig
$ ls
To stop recording run exit command.
$ exit
In above session we ran date,echo,time,ifconfig,ls commands, and stored output in time.txt and session1.txt
To replay recorded session use scriptreplay as shown below:
$ scriptreplay time.txt session1.txt
It will replay whole session that we recorded by you.
No comments:
Post a Comment