how can i create a splitted variable output for a bash program, like htop does to show variable outputs on different sections of the terminal - linux

im trying to write a bash script and i want it to be able to divide the screen in 2 sections and show a message on one of them and the output of a command in the other without having to split the terminal window just like htop or nvtop. I looked it up everywhere and im not getting a place to start.
top segment:
echo "now we are executing x command"
bottom segment:
sudo apt update -y
#above command's output
blablablablabla updating this and that
updated
your repositories work
blablablablabla
image for reference :
htop divisory lines
i looked everywhere on google and couldnt get a starting point, I also search for a way to leave a static header on the terminal with the command output refreshing underneat but still no luck finding something useful

Your reference image is for bashtop
That github project code would likely give you hints on how to proceed for what you want.

Related

How to navigate from running python script in ubuntu terminal?

I am currently running a python3 script in Ubuntu server 18.04. When i type new commands into the command line it just prints the commands. My terminal window looks like this:
mitch#server:`$ cd /home/mitch/folder
mitch#server:`/folder$ python3 main.py
file running ...
text i input just shows like this
I need to keep the script running and run other commands, how do i navigate back to:
mitch#server:`
I'm new to servers/Ubuntu/commands so this may seem trivial! Thank you
So you can't "navigate" back to that, since you're technically already there, you're just running a script in your shell which is occupying your shell - think of it like you opened a program in full screen.
But you have a few options:
The most basic is to run the script in the 'background' this is a simple as adding a & to the end of your command (note that it will still send any message from the script into your terminal - if your script is programmed to send messages that is).
Another option is to use a terminal multiplex like which lets you have multiple terminals open, as well as split screen terminals and many other features. One of the more popular multiplexers is called tmux, just keep in mind that it does have a bit of a learning curve to it, but is extremely useful once you learn it.

Conky/Dzen2 Clickable Areas

I'm trying for the first time to use dzen on my setup, then on the Arch Wiki I came up with the section about clickable areas, to pipe the command into conky and then when I click the text on conky the dzen2 script would show up.
But the command on conky simply doesn't work. I tried writing every way but it doesn't. The wiki says the following:
Save this script and make it executable and then use the ^ca()
attribute in your conkyrc (or the script that you pipe to dzen2) to
trigger it.
^ca(1,)Sysinfo^ca()
But it does nothing. When I replace the path to my script it just shows this command in form of a conky text. If I execute my script on terminal it runs correctly, but this command on conky does nothing at all.
I had the same problem. In my case it was caused by installing it from some fork (actually, it's first page that is searched by google under dzen2).
Installing from robm github made it work.

How less command shows output on stdout

I tried less command to view files in a zip file and to my surprise when I was done with the output, all my previous screen data was still present (which is not the case if i use more command for viewing a file content).
how does less command able to do this ?
Please refer the below images for more information..
before running the less command below is the terminal content,
After running the less command below is the terminal content,
How is less able to retain the terminal information unlike other commands like cat or more or zcat ?!
Any reference on this would also be of great help !
Thanks in advance..

How to run selected text using keyboard shortcut joined together with a command in background?

I am trying to be able to select text anywhere within my manjaro linux system and run it along with a TTS text to speech program. The program is called google_speech and it got a really clear default voice and is really easy to use, however I am finding it hard to implement what I want to do with it...
The program is ran by the following command:
$ google_speech -l en "I am just a robot but one day I plan to rule humans"
so I am trying to be able to select text and press a keyboard shortcut and the text will automatically be importing here:
$ google_speech -l en "HERE"
and ran as a command in the background hopefully without having to open a terminal window but if so then thats totally fine... I was thinking xclip would be able to do this but I can figure out what command or options I need to be using... my research so farhas gotten me nowhere...
Thanks you so much for your time and skills...

Trying to install program, keep getting problems

I'm currently an intern that's out of their depths here, this is really my first time using Linux, and everything I know comes from basic level tutorials.
I was asked by my boss today to install a program, and I'm following this tutorial on it, but am stuck at the Path part of it.
Solved
Every time I try to do this:
~$ export DTITK_ROOT=${autofs/cluster/name/MyUsername/more/path/DTI-TK/dtitk-2.3.1-Linux-x86-64}/dtitk
Like it told me to.
I get:
bash: DTITK_ROOT=${autofs/cluster/name/MyUsername/more/path/DTI-TK/dtitk-2.3.1-Linux-x86-64}/dtitk: bad substitution
Thank you user Muon
In bash, the ${} syntax can be used to substitute in the value of a previously defined variable, and you've enclosed an explicitly typed-out path within it, so bash is looking for a variable called path/MyUsername/more/path/DTI-TK/dtitk-2.3.1-Linux-x86-64 and not finding it. It should work if you run the command without the substitution:
$ export DTITK_ROOT=/path/to/dtitk

Resources