I have root access to a Linux system and need to log processes without installing any additional software, using only built-in tools like top. However, I want the process to run in the background continuously until I manually stop it, unlike top which only shows real-time data.
Here’s what I need:
-
When the command is executed, it should capture the initial state of all running processes.
-
If any new process spawns or an existing process terminates, the log should capture the timestamp, the command, and user info for those changes.
-
When I stop the logging, it should also record the final state of the processes at that moment.
How can I achieve this using built-in Linux tools?