Most Unix-like operating systems feature a script command. You can find its manual in script(1) (type
man 1 script to access it).
script records a transcript (“typescript,” not to be confused with the language TypeScript) of your current session in the command line.
The script command can be used as a way to log what you are doing in a shell session. It’s often used during troubleshooting, documentation, PCI compliance audits, security/remediation work, penetration tests, and other situations where it’s useful to record a play-by-play log of what you’re doing on the machine.