Linux – How to record Linux commands

command-line-interfacehistoryinstallationlinux

Is there a way to record the Linux commands I use and reuse them on another machine or in case I want to reinstall the machine?

In example record how I set up NginX, PHP and permissions in my lab environment and then repeat the exact commands on my deploy machine?

Best Answer

Seems to me like you want script(1).

It allows you to record and replay terminal sessions.

On the other hand, if you are trying to automate setups, consider configuration management, like puppet.