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: 0) by Anonymous Coward on Thursday January 17 2019, @04:10AM (1 child)
It's usually better to stick to grep/awk pipes than use regex you don't understand. You might want to modify the script later, and spending hours figuring out something someone else wrote is infuriating.
cpucount=$(awk '/MHz/' /proc/cpuinfo | wc -l)
for cpu in $(seq 1 ${cpucount})
do
grep MHz /proc/cpuinfo | awk 'NR=='${cpu}'{print "CPU'${cpu}': " $4 " MHz"}'
done
[ac][~]:sh cpuinfo.sh
CPU1: 3782.316 MHz
CPU2: 3593.783 MHz
CPU3: 3596.303 MHz
CPU4: 3691.905 MHz
(Score: 2) by Farkus888 on Friday January 18 2019, @12:31AM
Spending hours figuring out your own regex years later isn't any better.