I am looking for any terminal emulator (if any out there), which will have 2 separate areas for input commands and output area.
Terminal Emulator
Output
more output
more output still...
blah blahh
blaahh blah
words
=================================================
>input here
I tried to search in Google but found nothing useful, also I read somewhere this can be achieved using ncurses library, but I have no idea how this can be done. Also I feel, somebody must have done this before, if anyone has done this kind of thing, please share your solution with me, or anyone who knows how this can be done, then I would be grateful if you can provide me some pointers to achieve this.
You can simulate such behaviour with any terminal, by open two instances of it. At terminal #2, get the current PTS by:
$ tty
/dev/pts/10 # for example
then, on terminal #1 you type:
$ exec &> /dev/pts/10
$ echo you can see this message on terminal \#2
$ echo this is also true for standard error > /dev/stderr
Related
So I was installing node and somehow I ended up in the /user/local/bin folder checking what was there.
I wanted to so a ls | grep node but did a ls | cat node. The node directory then started to show itself in all its glory. I chuckled, laughed, then stopped the cat but that left my terminal looking something like this:
It is easily fixable by exiting the window.
I don't recommend you try it but i've managed to recreate it reliably. Just cat the node directory leave it for a few seconds then cancel it.
My question is what on earth is going on here? AFAIK using cat shouldn't be able to make this stuff happen.
Terminals interpret certain combinations of bytes as commands. This is how command line programs can output colors, or change the cursor position. What you're seeing is the output after one of these commands activated a box drawing character set by accident. You can activate it yourself with echo or printf:
my cool prompt$ printf '\033(0'
└≤ ␌⎺⎺┌ ⎻⎼⎺└⎻├$
To get out of this mess, type reset and press Enter - it will clear the screen and set all settings back to default.
└≤ ␌⎺⎺┌ ⎻⎼⎺└⎻├$ ⎼␊⎽␊├
(..screen clears..)
my cool prompt$
You managed to output the contents of the node executable to the terminal. What happens when you output random octets to the terminal depends on what those characters are and on the terminal. It often leaves the terminal in a state that the user did not really expect.
I’ve searched and read many posts but none actually describe what I would like to do. Using Debian Stretch, I’ve been trying to create a Python 3 program that runs what would otherwise be a typed command with switches at the gnome terminal. This is how it should run:
Double click the created *.py file that contains the code for the program.
The gnome terminal appears and the command/switches appear after the $ and then the program runs. Some of the switches have zeros (0) which seems to present an issue. Example command:
$ ./binary.bin -j 0 -n 1300
Anyone have any ideas on how I should start to write this program? Any suggestions would be helpful. Thank you.
I am not sure if this is possible but I couldn't find the answer anywhere else or even people who have tried it but my current PS1 is this:
export PS1="\[\e[00;32m\]??\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[01;31m\]\d\[\e[0m\]\[\e[00;37m\] \[\e[0m \]\[\e[01;31m\]\T\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[00;32m\]>\[\e[0m\]"
It is showing up and working upon opening the terminal however I am wondering if it was possible to clear the screen after a command finishes (with a prompt similar to windows cmd 'pause' command if possible) so that it isn't repeated or shown at the bottom of the window
I am running Manjaro XFCE if it makes a difference.
Thanks!
You can try something like this:
PS1='$(echo "(press enter to continue)" > /dev/tty ; read ; clear) $ '
NOTE: You need the redirect > /dev/tty because the standard output of the commands run by PS1 goes nowhere.
Replace the ending $ with whatever prompt you want to show.
I don't really think it is such a good idea. In the short time I've been testing that, it is so irritating!!!
I think you are way better just pressing Ctrl+L befor typing your command to clear the terminal.
I use the command xdg-open quite a lot in my Ubuntu Linux terminal. However, two things irk me:
Is it possible to suppress the error messages?
Is it possible to get the command to always complete? (That is, not continue running, so that I have another "new line" in my terminal).
I realize 2 may not be possible, because of the way the program works, but I imagine 1 is.
First one is easy. Just
alias xdg-open="xdg-open 2>/dev/null"
If you want it permanently, just add that line to ~/.bashrc file.
I recommend you to think twice if you want to become blind to errors, though.
The second one is quite confusing to me. xdg-open shouldn't be intereactive. In my computer (Debian sid) xdg-open execs the command and ends, even if the command itself has not ended (ie: you have not closed the application opened for the URL). I think this should be the behaviour of xdg-open on any platform (it's supposed to work exactly the same way on any XDG system, that's its very purpose).
Anyway, for any command you launch in a shell, if you want it to be non-interactive, that is, to allow to enter commands even if the previous one hasn't finished, you just attach "&" to the end of it. Example:
# prompt is not shown until you close the calculator
$ gnome-calculator
# prompt is shown right after opening calculator and you can
# work on the shell even if you don't close it
$ gnome-calculator &
I maybe late for the answer, but I got exactly the same problem like you have / had.
I tried to start a URL with xdg-open, my default browser is firefox, and not xdg-open but firefox started with an error:
[user#user-pc ~]$ xdg-open https://www.google.de # the page opens fine, but firefox had an error
[user#user-pc ~]$
(process:3783): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
# needed to press enter here
xdg-open closed fine but the firefox error stayed and I need to press enter to get the bash moving.
To get along this problem I called xdg-open within a new shell putting those output to /dev/null:
bash -c "xdg-open https://www.google.de" 2> /dev/null
The page opened fine, no error shown – rather nothing has been shown. And no need to press enter.
I'll be glad if someone can fix the title to be more appropriate since I'm pretty new to terminal.
I have an issue with terminal. Once I execute a command, if it goes to the next line, I can't close it or revert it. I assume it starts the executable or asks for more parameters using >
For example:
//Windows Machine
vagrant up
//Vagrant Instance Unix Machine
$ git
>
>
>
> ... it goes on like this, I can't close > so I can't execute other commands
The only solution on fixing is restarting the terminal (which means I need to restart Vagrant instance)
It happens on some commands only - not all, so I don't know what makes a difference.
For example, executing composer, I get information about Composer and terminal goes back to main state. However, if I execute things like php, git, mysql, > symbol appears and I can't return from there.
So, two basic questions;
What causes this?
How can I terminate the current command to go back main state?
Any help would be greatly appreciated.
Ps. I use both windows terminal and unix terminal and this issue happens on both.
Normally you'll see a > prompt if you've entered a command that's syntactically incomplete, for example if there's a unterminated string literal:
$ echo 'hello
> '
hello
$
It means that the shell is waiting for you to type the rest of the command, or at least enough of it to make for something that's not a syntax error.
In this example, the default prompt, $PS1, is '$ ', and the secondary prompt, $PS2, is '> '. Read the documentation for your shell (probably bash) for more information.
You can cancel the current command and get back to your primary prompt for a new command by typing Control-C.
This is all about the behavior of your shell; it has nothing to do with your terminal (almost certainly a terminal emulator), which merely provides a GUI for your shell to run in.