Bug 450132

Summary: RFE: pipe terminal output to file in parallel
Product: [Applications] konsole Reporter: Mattia <mattia.verga>
Component: historyAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: ninjalj
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: attachment-31182-0.html

Description Mattia 2022-02-13 08:22:22 UTC
SUMMARY
I'd like to request the feature to pipe the terminal output in parallel to a file.

This is different than the "File -> Save Output As" option: the current behavior is that one can save the history already showed in the terminal. But if one have a very long history to save it may miss the tsart if the scrollback lines parameter isn't set enough high in the profile; or one could set it to unlimited, hoping to not bog the RAM.

My request is to pipe the output (all output showed, including using input) to a file while it's being outputted to the terminal. So, the scrollback history doesn't need to be modified, but even if the output is longer than the history it will be available in the file.
Like a "start logging to file" and "stop logging to file" button.
Comment 1 ninjalj 2022-02-13 10:07:36 UTC
Why not just use script(1) (https://man7.org/linux/man-pages/man1/script.1.html) ?
Comment 2 tcanabrava 2022-02-13 10:55:26 UTC
Created attachment 146662 [details]
attachment-31182-0.html

I sincerely like that.


Le dim. 13 févr. 2022 à 09:22, Mattia <bugzilla_noreply@kde.org> a écrit :

> https://bugs.kde.org/show_bug.cgi?id=450132
>
>             Bug ID: 450132
>            Summary: RFE: pipe terminal output to file in parallel
>            Product: konsole
>            Version: unspecified
>           Platform: Other
>                 OS: Linux
>             Status: REPORTED
>           Severity: normal
>           Priority: NOR
>          Component: history
>           Assignee: konsole-devel@kde.org
>           Reporter: mattia.verga@tiscali.it
>   Target Milestone: ---
>
> SUMMARY
> I'd like to request the feature to pipe the terminal output in parallel to
> a
> file.
>
> This is different than the "File -> Save Output As" option: the current
> behavior is that one can save the history already showed in the terminal.
> But
> if one have a very long history to save it may miss the tsart if the
> scrollback
> lines parameter isn't set enough high in the profile; or one could set it
> to
> unlimited, hoping to not bog the RAM.
>
> My request is to pipe the output (all output showed, including using
> input) to
> a file while it's being outputted to the terminal. So, the scrollback
> history
> doesn't need to be modified, but even if the output is longer than the
> history
> it will be available in the file.
> Like a "start logging to file" and "stop logging to file" button.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 3 Mattia 2022-02-13 12:16:02 UTC
(In reply to ninjalj from comment #1)
> Why not just use script(1)
> (https://man7.org/linux/man-pages/man1/script.1.html) ?

I wasn't aware of script. Anyway, it does the work but I get bad characters in output:
```
Script started on 2022-02-13 13:08:26+01:00 [TERM="xterm-256color" TTY="/dev/pts/3" COLUMNS="92" LINES="33"]
]0;mattia@Hamal:~/Devel/fed-users[?2004h[mattia@Hamal fed-users]$ exit
[?2004l
exit

Script done on 2022-02-13 13:08:46+01:00 [COMMAND_EXIT_CODE="0"]

```
I suppose it should be tweaked in some way, but I'd like something more user friendly and easier for a user to discover rather than searching through linux scripts.
Also, by default it doesn't flush the output in real time (I had to search through the options to find the '-f' flag).