script -a “/home/coalrock8642/terminal_records_($ date +%Y_%m_%d).txt”
I need date but not working.
Typo: you need to reverse “($” to “$(“.
Yes and no? I did tried all? of the combinations
This works for me. Look closely at the difference.
($ is replaced with
$ script -a terminal_records_$(date +%Y_%m_%d).txt Script started, output log file is 'terminal_records_2023_04_27.txt'.
The image shows incorrect quoting:
' used where
" is required. It is often unproductive to jump in with a complicated command-line if you have not learned the basics.
I used to run practical sessions for a course organized around a set of linux command-line tools. Most of the participants (select groups of PhD scientists) had only used Windows. For a 2-week course we found it well worth devoting a couple afternoons to linux command-line basics. One of many good references is Linux Command.
Edit: remove stray dash
See clearly and more accurately, but I guess I’m doing some qouting wrong, can you just post what is correct script -a …?
This is what I got with a simple test.
$ script -a logfile_$(date +%y_%m_%d).txt Script started, output log file is 'logfile_23_04_29.txt'. [user]$ echo 'this is only a test of the script tool' this is only a test of the script tool [user]$ echo another_test another_test [user]$ exit exit Script done.
Then to see what was written
[user]$ cat logfile_23_04_29.txt Script started on 2023-04-29 09:19:43-05:00 [TERM="xterm-256color" TTY="/dev/pts/1" COLUMNS="140" LINES="24"] [user]$ echo 'this is only a test of the script tool' this is only a test of the script tool [user]$ echo another_test another_test [user]$ exit exit Script done on 2023-04-29 09:20:56-05:00 [COMMAND_EXIT_CODE="0"]
Note that everything on the screen is saved in the script file created, and script is intended to do just that: Save what is done on the screen for later use.
Now why is this not working.
is this bug now?
This command creates the script file into which further screen commands and results are saved.
It does, however, run under the users shell and is not a shell in itself.
If, you are expecting that to be the users shell it will not work.
What is the actual goal here? Are you intending to have the system provide you a log of what you or another user does while logged in? Are you trying to use this as a keylogger? or what?
The script command is intended to assist in creating a shell script to automate what a user may do once at the terminal. It does not replace a users shell but is a tool to use within the users shell.
I just wanted to, record my terminal outputs, probably other users, but mostly the commands I enter, not passwords, and its outputs.
That is certainly what the script command is intended for, but not for continuous use since that would be a large waste of space and time to peruse it.
You can (with the bash shell) see the list of commands used with the ~/.bash_history file which saves the command history and updates every time you log out or close a terminal window. Other shells have similar history of commands used.
You also can scroll through recent commands and results while in the terminal window so see what was done in the current session.
Using the script command is really simple.
Start it then do what you wish. When done simply use exit to end logging. It cannot be simpler than that.
The script command is only active in the shell where it is started, so having more than one terminal window each with its own script being recorded would mean each would require a unique log name it writes to. Automating it gets complex and is subject to breaking.
how about I make a bash file, modify core’s console and terminals to call this file and
I see, did not read all of this yet.
But “.bash_history” not recording all or need to increase it’s recording length. And it records inputs (except passwords.) But I need to log terminal and console outputs to record failure, like installations and repo cloning. (Which this does not record?)
I hope this be more feature of logging carefully, and fedora involve this feature in Core OS.
I can give you the answer, but you really won’t learn much if anything that way. Please consult a high-quality linux reference document to learn the rules for quoting. Then you will know where to go next time the command-line gives an error. Note that rules for quoting in linux differ from Windows cmd.exe or pwrsh.exe terminals.
A small typo in the URL, it should be linuxcommand.org, without the dash.