Any quick ideas on how to write a program that extends the terminal's basic functionality? I want to do everything the terminal does but additionally do some custom processing on whatever the user types on my terminal derivative.
closed as too broad by Jeff Schaller♦, Anthon, Scott, Stephen Kitt, garethTheRed Jun 4 '16 at 9:02
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Download the gnome-terminal source, add your custom processing and recompile. Source is at https://git.gnome.org/browse/gnome-terminal/ Not clear what the 'custom processing' entails, from your original question.
If you don't need "live" data, you could, by reading
man bash, use per-PID
$HISTFILEs and send the saved commands off to the internet later. A simple matter of scripting rather than source modification. However, uncooperative users can defeat this approach.
One of my answers on AskUbuntu discusses the first part of the method.
man bash again) can do the rest.
From your description of what you want to achieve it sounds like it's not so much the terminal as it's you shell (and judging from your tags that's bash) that you want to extend.
The way to that is by modifying the source code, you can find that on the project's home page.
Another way of achieving what you want might be to make sure that every users shells run inside
script, that program saves both in- and output of every command (and for commands that provide changing output (like progress bars) the output can be hard to read). You'll probably have to write some kind of wrapper that makes for a command suitable for placing in
/etc/passwd and saves in a uniquely named file (I would suggest using a combination of uid and time). If you use the option
-f, the file is written after each write to stdout/stderr. It's an absolutely non-trivial task to determine what's input and what's output, but it might still be simpler to achieve something satisfactory than by modifying bash.