F
F
fowiv2020-01-22 12:55:20
linux
fowiv, 2020-01-22 12:55:20

How to make terminal text output permanently saved to a file?

People, all welcome!
How to make terminal text output permanently saved to a file?
It is necessary to save everything that will be written in the terminal for 1 day, all text into one file.
Where can I make settings? Maybe there is a program that will monitor the terminal and copy everything from there to a file?
Just do not suggest, please, save each command in the terminal with handles: command > output.txt
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
fowiv, 2020-01-22
@fowiv

Thank you all, there is a cool thing called a script!
Using the command script output.txt writes everything to a file.
With the exit command, it stops.

Y
Yuri Samoilov, 2020-01-22
@takezi

Add to the end of /etc/profile :

function log2syslog
{
   declare COMMAND
   COMMAND=$(fc -ln -0)
   logger -p local1.notice -t bash -i -- "${USER}:${COMMAND}"
}
trap log2syslog DEBUG

Add to the end of /etc/rsyslog.conf :
Restart rsyslog :
Audit will be in /var/log/syslog and /var/log/cmdline

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question