• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

linux terminal and up key

Red Squirrel

No Lifer
Why is it that in Linux when you are in a certain app such as nslookup if you hit up it gives the ]]A~ crap? is there a way to make it like Windows where it shows the last command?
 
at a normal shell, up arrow will give you the last command. if you are within a terminal app like fdisk, then it is dependent on that app. Just tried nslookup on one of my machines, and yeah, it does weird stuff. thats nslookup specific, so without delving into the code (which I am not capable of), sorry, but I cant be of any help other than what Ive already said. if you are using putty, just highlight the command, and right click to paste it into the terminal. otherwise copy and paste, obviously not using Crtl+C
 
There are some wrapper programs out there that can give up key support to apps that do not have it. I use one for sqlplus (can't think of the name of it atm).
 
Along these lines.... I've got a new machine that runs Sun OS 5.1 (it's a front end RIP/Controller for a high end copier). Same thing with it not allowing for using the up arrow. It's running TCH, but even when I jump to BASH there's no difference. I've gotten around it with things like !?xx? or !(string), but it's not the same.

Anyone know how to get the history to scroll with the up/down cursor keys?

Joe
 
Add:
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward

to your ~/.bashrc file.


That will make it so if you go:

ls <arrow up>

It will search backwards through your history for commands that started with 'ls'
 
Errr... Oops.

that's not what your asking.

Basically what is happening is that your entering a sub-shell. Your exiting out of your bash shell and entering into a nslookup shell. Totally different environments.

Another example would be command-line ftp, or the telnet program when your running the program, but not connected to a remote system yet.


....

Another problem could be that your particular terminal emulator isn't doing a very good job.
 
Originally posted by: Netopia
Along these lines.... I've got a new machine that runs Sun OS 5.1 (it's a front end RIP/Controller for a high end copier). Same thing with it not allowing for using the up arrow. It's running TCH, but even when I jump to BASH there's no difference. I've gotten around it with things like !?xx? or !(string), but it's not the same.

Anyone know how to get the history to scroll with the up/down cursor keys?

Joe

Using Bash in vi mode on Solaris 5.8, I have to press down before I can go up. Yay Sun.
 
Down arrow results in ' ^[B ' being entered on the command line and then the B immediately disappearing.

Up arrow results in ' ^[A ' being entered on the command line and then the A immediately disappearing.

Backspace results in ^H

Any ideas?

Joe
 
Actually I noticed this is a windows thing.

Theres this program I wrote that compiles in windows and linux. In linux when I try to use up key I get all the weird crap, in windows it goes back to the last entries I typed.
 
What do you mean "this is a windows thing"? The up and down arrows should work in a Linux terminal to move forward or backward in the history. "MOST" of the machines I connect to work fine in this regard, except for a VERY old SCO Unix box, a Solaris 5.3 box, and one or two Linux boxen.

Joe
 
In the terminal itself it works but not in other apps (Ex: nslookup etc)

And its not app specific as I wrote my own command line app that works in windows and linux and the windows one works with up key and I never coded that in.
 
Is it possible that it is shell related? Some shells support history / up arrow and some don't.

Is it possible / likely that the application would tie the up-arrow action to how it interacts with STDIN from the shell?

Just taking a stab at it, I don't really know one way or the other.

Try it from different shells and see if the behavior changes.
 
The program which can give readline-like history capabilities to any other command line program is called 'rlwrap'.

rlwrap nslookup # and you should get history

Another question: why are you using nslookup? That's been deprecated for over 5 years, I think? Use dig.
 
Back
Top