Gnu Screen asks for password when I close a screen: what password does it want? - macos

I have multiple screens running the same long process.
When I try to close one (C-a, x), I get a blank screen with:
Key: •
When I type anything and press return, I get:
Again: •
If it's different, I get "Passwords don't match" and if it's the same I get:
Screen used by Andrew Swift <local>.
Password:•
My administrator password doesn't work.
How can I close the screen correctly?

The CTRL-A x - mean "lock the screen".
So, it asking you for the locking password (of course twice). You can enter any string. Of course, when they did't matches it says mischmah.
After you locked the screen session, you need enter the password again for unlock the session. Simply enter the chosed password again.
Instead of locking, you can "detach the screen" session (CTRL-A D) or you simply use CTRL-D for ending the running shell..

C-a x is the default combination for "lock screen", not "close". It's asking for a password twice to set that password, so that you have to type it again to get back in.
The normal way to close a screen window is to exit the shell at its root, usually by typing exit. Pressing C-d (which sends an EOF character) may also work, depending on the shell.
I just came upon this "cheatsheet", which summarises the various commands quite well: http://aperiodic.net/screen/quick_reference

Related

How can I reset my terminal in a GNU screen session after accidentally printing binary garbage?

Sometimes I accidentally print binary garbage on the screen, for example I have printed a binary hash value or nonce instead of the hex hash value.
Sometimes the terminal is messed up in various ways after this, because the binary data contained escape sequences which reconfigure the terminal, rendering it almost useless.
When in a normal shell (locally or via ssh) it is usually sufficient to blindly type reset and press enter. (Often the typing is not visible due to the messed up terminal configuration.)
But when in a shell which is inside a GNU screen session this is sometimes not sufficient and the shell is still unresponsive.
How can I revive my terminal without destroying it and re-creating it?
The GNU screen terminals maintain part of the terminal state, too. To reset that in GNU screen do:
Press Ctrl-A.
Enter :reset and press enter.
Done. You may also need to enter reset in the terminal itself as well as usual.

Scripting in QWS3270P Pulse mainframes.

I'm using qws3270P emulator to interact with mainframe. I just want to build/develop some script files. So that i can do 30m long repetitive process just by running the script file. The file format the emulator is accepting is .scr format. I have done a lot of research on it but i could not conclude with one. My interface has 3 screen to go to ISPF utilities. In first screen i need to type k, then enter, then next screen a, then next screen i need to enter User name and password, then enter then i will land to ISPF utilities
key "enter"
type "k"
Key "enter"
type "a"
key "enter"
type "username"
key "Tab"
key "password"
key "enter"
type "ispf"
In that emulator i could not able to go ispf. All the thing are projecting in Very first screen itself. Can anyone help me with this scripting code ?. i tried by using wait syntax also

How to keep terminal input always at bottom in Golang?

I am trying to create a program which will have live updates from some data source. And I also want to wait for user input just like a normal terminal. Right now, whenever there is update, I will print the content and print the prompt message for input again which create something like this:
Enter command >
This is a live update message
Enter command >
This is a multi-line li......
......ve update message
Enter command > quit
Bye bye!
The problem is that for every live message I received, I will print it and the "Enter command >" will be displayed again again and again, which is not desired. I want the live update to be update on the main part of the terminal, while the "Enter command >" always stay at the bottom
The closest package I can found on Github is https://github.com/gizak/termui but most of the examples inside is trying to display text, gauge and graphs. So I am not quite sure how to get started.
Is there any package or example of the termui package to achieve this? Thank you.
With github.com/gizak/termui you're heading in the correct direction.
To understand why you can't get that
I want the live update to be update on the main part of the terminal, while the "Enter command >" always stay at the bottom
part sorted out, a little excursion to the history of computing is due. ;-)
The thing is, the mode your teminal emulator¹ works by default originated
in how computers would communicate to the operator in the era which predated
alphanumeric displays — they would print their responses using a line printer. Now think of it: a line printer works like this: it prints whatever is sent to it on a roll of paper. What was output, was output.
The new output always appears physically below the older.
When alphanumeric displays (screens) came into existence they
naturally continued to support this mode:
the line text to be output was rendered at the bottom of the screen
with the text above it scrolled upwards.
That's what you see in your typical terminal emulator all the time when you're working in the command line of a shell (such as bash) running by the emulator window.
This, default, work mode of a terminal is called "canonical" or "cooked".
Then came more advanced displays, for which it was possible to change
individual positions on the screen — identified by their column and
row numbers.
This changed the paradigm of how the information was output: the concept
of a so-called "full-screen application" was born.
Typical examples of them are text editors such as Vim and Emacs.
To support full-screen text output, terminals (and terminal emulators)
were adapted by implementing certain extensions to their protocols.
A full-screen application first requests the terminal to switch into another
mode called "raw", in which the terminal sends most of what is input by the
user directly to the program running on the terminal.
The program handles this input and orders the terminal where and what
to draw.
You can read this good summary
of the distinction between the both modes.
As you are supposedly suspecting by now, to be able to keep some block
of information at a certain fixed place of the terminal's text screen,
you want your program to be a full-screen program and use the terminal's
raw mode and its special commands allowing you to directly modify
text at certain character cells.
Now the problem is that different terminals (and terminal emulators)
have different commands to do that, so there exist libraries to isolate
the programs from these gory details. They rely on the special "terminal
information databases" to figure out what capabilities a terminal has
and how to make it do what the program asks.
See man terminfo for more background.
The most widely known such library (written in C) is called ncurses,
and there exist native solutions for Go with supposedly the most visible
one being github.com/nsf/termbox-go.
The github.com/gizak/termui makes use of termbox-go but for you it might
suffice to use the latter directly.
¹ Chances are very high you're not sitting at
a real hardware terminal
connected to a UNIX® machine but are rather working in a GUI application
such as GNOME Terminal or xterm or Termial.app etc.
These are not "terminals" per se but are rather
terminal emulators —
that is, pieces of software emulating a hardware terminal.

emacs DELETE/C-h confusion on OS X

Going through the tutorial on emacs, I got stuck on the deleting part, because by default DELETE key sends me to help. I've tried adding a few popular commands to the .emacs file such as (normal-erase-is-backspace-mode 1). So with that in my .emacs file, I hit C-h and get the screen that says This buffer is for notes you don't want to save..., then hit t and it just enters the letter into this "buffer". DELETE does what it's supposed to do now, though. When running emacs -q instead, I end up at the same "buffer" screen, except when I hit t it actually takes me to the tutorial, but the problem is of course that DELETE does not delete. Any solutions to this? I'm on a MacBook with OS X 10.9.4, using the Terminal.
The answer is in the Emacs manual, node DEL Does Not Delete. Just customize option normal-erase-is-backspace. Or use M-x normal-erase-is-backspace-mode to toggle the value.
Hmm, but I see now that you have added that you tried this. I do not understand what you mean by "notepad", so I do not understand that part.
Try this also, at a command prompt (assuming you are on GNU/Linux or similar):
stty erase ^H
And see various writeups on the web about stty erase. (IOW, google stty erase.)
When you say DELETE, I'm guessing (hoping) that you mean the key labeled Backspace and not the key labeled Delete. What does C-h k tell you when you use it and then hit each of these keys?
the key labeled Backspace
C-h, that is, press and hold Control then hit h
the key labeled Delete
(And just which keys are you using to get the behavior that does not work?)

How to hijack the Caps Lock key for Cut, Copy, Paste keyboard operations

Here is what I am trying to accomplish:
To Copy, press and release Caps Lock ONCE
To Paste, press and release Caps Lock TWICE, quickly
To Cut, press Ctrl+Caps Lock
The reason I want to do this is often times i find my self looking down to press the correct X/C/V key, since they're all next to each other (atleast on a QWERTY keyboard).
How can I do this on a standard keyboard (using Windows), so that it applies to the entire system and is transparent to all applications, including to Windows Explorer? If not possible with a standard keyboard, can any of the "programmable numeric keypads" do this you think?
In the above, by "transparent" I mean "the application should never know that this keystroke was translated. It only gets the regular Ctrl+X/C/V code, so it behaves without any problems".
Ps. Not sure of all the tags that are appropriate for this question, so feel free to add more tags.
SOLVED. UPDATE:
Thank you to #Jonno_FTW for introducing me to AutoHotKey.
I managed all three requirements by adding the following AHK script in the default AutoHotKey.ahk file in My Documents folder:
Ctrl & CapsLock::
Send ^x
Return
CapsLock::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 1000)
Send ^v
Else
Send ^c
Return
That was easy!
NOT COMPLETELY SOLVED. UPDATE:
The above works in Notepad, but NOT in Explorer (copying files for example) or MS Office (even text copying does not work). So, I need to dig around a bit more into AutoHotKey or other solutions. Will post a solution here when I find one.
In the meantime, if someone can make AutoHotKey work for everything I need, please reply!
ALL SOLVED. UPDATE:
All I had to do was to change the capital "C"/X/Z to lowercase "c"/x/z. So Send ^C became Send ^c. It now works in ALL programs inlcuding Windows Explorer! Fixed code above to reflect this change.
I believe the program you are looking for is AutoHotkey.
You need a Global Keyboard Hook.
Very nice! Been looking for something like this for a while.
My script is slightly different, making use of shift or control combinations for cut/copy, then CapsLock on its own is always paste.
Ctrl & CapsLock::
Send ^x
Return
Shift & CapsLock::
Send ^c
Return
CapsLock::
Send ^v
Return
If you wanted to retain the option of retaining the Caps Lock function, I presume you could always remap e.g. Alt-CapsLock for this. I couldn't get it to toggle correctly when I tried it though.

Resources