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.
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.
Premise: I coded a Tkinter GUI for a python script. It works. I can launch it from terminal. I created an icon and the icon will show up in my GUI just fine. I've been looking for tutorial on .desktop launchers and none of the examples I've found work. After a few hours of wading through SEO spam in SERPs trying to find a tutorial on the subject or a forum question that has been correctly answered. Finally I decided to join a forum ask a question. I've found a lot of code snippets on this site in the past. Figured I would try here.
I've tried about 20 different examples none of which have worked but I think I at least know the questions to ask. Here's an example of a .desktop file: It's not an example that works but it's one on found on this site so I figure I will start there.
[Desktop Entry]
Type=Application
Terminal=false
Icon=/path/to/icon/icon.ico
Name=ApplicationName
Exec=python3 /path/to/application.py
Categories=Application;
Note the example in the other post shows a red highlight over Categories=Utility; and when I try to change it in /usr/share/applications/ it makes gnome-terminal insert an A when hit the up key to get my last BASH entry and change a bunch of keys on my keyboard into hotkeys rather than being able to type it pops open print dialogs and things like that that which is wicked annoying.
Does anyone want to discuss what each entry line in a .desktop file is supposed to look like. Also does the application, icon, and everything have to be in /usr/share/applications? What file locations are ok to use in this type of file?
Something else I thought of; is it possible that my Exec line is not correct. Does exec have to be a single argument? Do I need to create a bash script that can be called by Exec that is just something like ./script.sh or should I create a command alias that is a single argument? Or does it actually matter?
I also have a Linux question: What package handles .desktop icons? Who maintains said package? And where can I find actual documentation on the subject?
I'm making a command interface for a node server, but I have reached a point that I want it to look better.
I want to have the console so you enter a command at the bottom of the terminal screen, you hit enter, and it adds the reply to the actual command line.
If you have ever run a minecraft bukkit server from the command line, you should know what I'm talking about.
Here's a picture of what I'm talking about if you still don't understand. Imagine this was in terminal, and ignore the scroll bars: http://cl.ly/1K0h1V0r0H3f3U3t3L22
Is there anyway to set the console to look like this without having to make your own program for it or having the screen reprint all the other info to fake that look?
I have not done this, but I believe something similar is possible with very little effort by using Node.js REPL. You can override the eval parameter to provide your own command processing.
It would not have the exact look you are wanting, but it will be an interactive prompt that you can utilize (more similar to a Windows command shell or a Linux shell).
If you want the exact look from your screenshot, I don't believe that there is any Node.js module that will help you. There are some that allow you to use colors in the console, and some basic highlighting (e.g. bold), but nothing that gives you complete control over the console screen.
This question already has an answer here:
My very simple Greasemonkey script is not running?
(1 answer)
Closed 6 years ago.
I am trying to get a Greasemonkey script to run on a page. But it does not.
How do you debug scripts?
What are the smallest possible baby-steps to start a new Greasemonkey script?
When I was starting with user scripts, my first error was not using wildcards.
// Broken:
// #include https://www.example.com/
// Working:
// #include https://www.example.com/*
That's the simplest way for the script to not even apply, and thus not run at all. In addition, make sure to check for syntax errors; a misplaced semicolon can prevent the script from being parsed, and thus it is ignored.
For me there was a syntax error in the script and Greasemonkey didn't give an error message. Copy-pasting the script to the JS Console revealed the secret.
you can write logs everywhere in your scripts to get better traces of what if being done in them:
GM_log("Hello, World!");
http://wiki.greasespot.net/GM_log
More info:
http://wiki.greasespot.net/Greasemonkey_Manual:Other_Useful_Tools#JavaScript_Console
Another tip: Take a look at the whole greasemonkey wiki. They have a lot of good stuff in there:
http://wiki.greasespot.net/Main_Page
In Firefox, open Tools > Error Console and watch it as you load the page. If you're getting overwhelmed by Warnings from the page you can filter on Errors, which still often highlights your script problem.
My greasemonkey script was working; I added a line; it stopped working; I removed the line; it still didn't work.
I determined that greasemonkey had installed a broken updater.php script when I reloaded the script with the new line added. Reloading the old script kept the broken version of the updater.php script. I eventually found an error message referring to the updater.php script in my Firefox Web console. I replaced the updater.php script with a file containing a comment after loading the new version of the script, and my script started being executed.
On mac, my updater.php was in: /Users/csimmons/Library/Application Support/Firefox/Profiles/81ri7k71.default/gm_scripts/Extended_LoU_Tweak
You may be able to find a similar updater.php file in your Firefox default profile gm_scripts/ directory.
Make sure that Greasemonkey is enabled in the first place:
Also, the syntax of #include is to have only one matching pattern. If you want another one, add another #include line.
If the URL of a page is set with Javascript instead of by navigating (like Instagram giving its popup windows a permalink URL), Greasemonkey will show the script as running but it actually won't start. Try reloading the URL and seeing if it actually goes to the same page. If not, you'll have to match the home page URL instead of the popup URL.
I had this trouble too; this was the solution for me:
Check the (and Modify the tricky) part of the code I was working on when it happen
uninstall and reinstall GreaseMonkey
then i got a real error report
EDIT: Today the probleme come more often than usually (new release?)
It looks like Firefox web tools are fighting with greasemonkey or JS engine for error messages.
So when you're looking somewhere (ctrl+alt+k) the error message appears somewhere else (try opening the other console) it's like a funny game.