2

Let's say I type a shell command in gnome-terminal/bash that spans multiple lines and run it.

shell> abcdef ghijk lmn
opq rstuv wxyz

Then when I want to run the same command again, I hit the up-arrow. Instead of seeing the same command again (which always used to be the case), gnome-terminal now only shows me parts of the last line with a < at the beginning of the line:

<stuv wxyz

That is, no prompt, just that line.

If I hit CTRL-A at that point, I will get the first line of the original command with a > at the end.

shell> abcdef ghijk l>

Here, the prompt is back.

How can I configure my setup so that hitting the up-arrow after a long command will simply display the complete long command again, spanning multiple lines and including the prompt?

2
  • This do not seems the default behavior. Can you please tell if the terminal profile has been changed, what shell are you using, if you modified ~/.bashrc, if you are using screen or every other possibly interesting information.
    – enzotib
    Aug 3, 2011 at 7:58
  • I actually found out right after posting this that I screwed up my TERM variable, but I do not have enough points to answer my own question yet.
    – Thomas
    Aug 3, 2011 at 9:47

2 Answers 2

2

Make sure that your TERM variable is set correctly, i.e. reflecting the type of terminal you are on. Typically, you would export the TERM variable in your ~/.bashrc file, as outlined by Justin Andrusk's answer:

export TERM=xterm

In the case of the question, I had played with a complex command to extract search terms from a file, and I used a variable named TERM for the search terms, without realizing the significance of that variable name.

1
  • this is why you should use lowercase variable names
    – wjandrea
    Sep 11, 2017 at 6:54
1

Modify your XTERM variable to 'xterm' in ~/.bashrc with:

export TERM=xterm

:)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .