I pressed the up arrow to use my last command and ^[[A kept showing up. What does it mean?
2 Answers
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.
-
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
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 less
ing 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...!
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 thattput reset
is the bigger-hammer approach if theterminfo
system is installed and configured.