To view the typescript of another user's terminal session in Linux, you can use the script
command.
The script
command allows you to record a terminal session and save the output to a file, known as a typescript. You can then view the contents of the typescript file to see what the user typed and what was displayed on the terminal.
To use the script
command, you will need to have the necessary permissions to access the user's terminal session and the typescript file.
For example, to start recording a terminal session and save the output to a file called typescript
, you can use the following command:
$ script -f typescript
This will start recording the terminal session and save the output to the typescript
file. To stop recording, you can press CTRL+D
or type the exit
command.
To view the contents of the typescript
file, you can use the cat
command or the less
command.
For example, to view the contents of the typescript
file using the cat
command, you can use the following command:
$ cat typescript
Or, to view the contents of the typescript
file using the less
command, you can use the following command:
$ less typescript
This will display the contents of the typescript
file, including all the commands that the user typed and the output that was displayed on the terminal.
Note that the script
command only records the output of the terminal, not the input. This means that it will not record the user's password if they enter it on the terminal.
To record both the input and the output of a terminal session, you can use the scriptreplay
command, which is a variant of the script
command that includes both the input and the output in the typescript file.