4

I pressed the up arrow to use my last command and ^[[A kept showing up. What does it mean?

3
  • It shouldn't be that way initially (it should function to cycle through the shell command history), but it may easily end up that way if, e.g., you have piped binary data through the terminal, or anything containing accidental ANSI sequences of some sort -- TBH I'm not sure exactly what the cause is, if it happens and it bothers me I just start a new terminal/login.
    – goldilocks
    Dec 28, 2015 at 19:50
  • 1
    stty sane {note that the second is not prefixed with a - argument introducer} will recover from a lot of the problems that @goldilocks described. Failing that tput reset is the bigger-hammer approach if the terminfo system is installed and configured.
    – SlySven
    Dec 28, 2015 at 21:02
  • @SlySven Sounds like an answer...
    – goldilocks
    Dec 28, 2015 at 21:04

2 Answers 2

6

Sounds like you are using sh instead of bash. sh does not do the back to last command. Just try typing in bash and it probably will work. The ^[[A thing is just the up key in some kind of terminal special key(space, control, F1 - 12 keys, etc.) thing.

1
  • This is frequently the case after making a new user and forgetting to set the new user's shell to something other than sh. If you want to permanently change a given user's login shell, try sudo chsh -s /bin/bash theusername Mar 9, 2018 at 6:23
4

Rewritten as an answer:

It means that something previously has either messed up the settings of your console or the definition of what the up-arrow key is supposed to produce/send, however the command stty sane {note that the second word is not prefixed with a - argument introducer} will recover from a lot of the problems like these that @goldilocks described when the screen is putting out what seems like gibberish. In really awkward cases the enter (or del or backspace) keys may not do what you expect however <Control>-M will usually work for the first of these...

Failing that tput reset is the bigger-hammer approach if the terminfo system is installed and configured.

In *nix circles "Everything is a file" - it is just that some files do not make sense as a human language and contain sequences of characters that cause unhelpful things to happen to the screen if displayed thereon! The magic system can be a great help for this, before more or lessing a file, if there is any doubt what you are about to show, you can use the file command with the name of the suspect thing as an argument and if the given file has anything making what it is distinguishable in any way this command will tell you. Incidentally this is why *nix systems are much less sensitive about file extensions - they do not have to rely on those to work out what a file is for...!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.