linux terminal and up key

Red Squirrel

No Lifer
May 24, 2003
70,029
13,493
126
www.anyf.ca
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?
 

Kakumba

Senior member
Mar 13, 2006
610
0
0
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
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
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).
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
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
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
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'
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
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.
 

Skeeedunt

Platinum Member
Oct 7, 2005
2,777
3
76
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.
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
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
 

Red Squirrel

No Lifer
May 24, 2003
70,029
13,493
126
www.anyf.ca
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.
 

Netopia

Diamond Member
Oct 9, 1999
4,793
4
81
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
 

Red Squirrel

No Lifer
May 24, 2003
70,029
13,493
126
www.anyf.ca
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.
 

ScottMac

Moderator<br>Networking<br>Elite member
Mar 19, 2001
5,471
2
0
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.
 

lousydood

Member
Aug 1, 2005
158
0
0
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.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |