Hi all,
I have been learning linux and have a secondary monitor that I wanted to use for showing some sensor data. Currently I need to manually enter in three commands and then arrange my windows each time I want to look at (and start-up, etc). I am using the nethogs, inxi, and lm-sensors libraries:
sudo nethogs
watch -n1 "inxi -s"
watch -n1 "sensors | grep Tdie"
The end result looks something like this:
https://i.ibb.co/TgWXKSn/sensors.png
Is it possible/easy to script the opening of these three terminal windows and position them onto a specific monitor? Or is there a completely different better way to go about this?
Also, is there a way for me to custom arrange the data on the screen? Eg, could I put the sensors "Tdie" data into two columns and remove the "high = +70.0 C" info?
[Beyond this specific case, is there a general solution with, say, a directory containing a separate shell script for launching each program, with a master script that specifies terminal width/height as well as (x,y) coordinates? --Ed.]
(Score: 2) by jimtheowl on Thursday January 17 2019, @03:12AM (3 children)
The history command is useful for capturing any sequence of commands you just typed. Just redirect it to a file. That file then become the basis for your script.
ie:
history > myscript
Add !/bin/sh at the start (for scripts, sh is more portable than bash), remove anything not required. You can replace values with variables if you want to make it more generic.
That is it.
(Score: 2, Informative) by Anonymous Coward on Thursday January 17 2019, @03:33AM (1 child)
Very helpful tip. Thank you. Except when I try to run something it opens in its own window:
I am sure I will figure it out though.
(Score: 0) by Anonymous Coward on Thursday January 17 2019, @04:06AM
not sure about gnome-terminal, but xterm and others use -e flag for this:
xterm --geometry 73x31+100+300 -e watch -n1 inxi -z -F
You can also use the flags to set window name/title/class to do some automatic detection for positioning etc.
(Score: 2) by maxwell demon on Thursday January 17 2019, @06:56AM
That should be #!/bin/sh
The Tao of math: The numbers you can count are not the real numbers.