One of the greatest additions added to the Windows OS in recent memory is hands down the Windows Subsystem for Linux which lets users run Linux environments such as command-line tools, utilities, and applications directly on Windows - without the need for a virtual machine. But if you're reading this article, you're probably already familiar with this (and in case you aren't, the installation process can be found here).
However, there is an ongoing issue (currently being tracked on the GitHub repo) where users are experiencing navigation/interaction problems once they have SSH'd into a remote RHEL/CentOS server. I too have been experiencing this on a daily basis considering 4 out of the 5 servers I currently run are all CentOS. Whether you're attempting to navigate with the arrow keys or simply deleting or using the backspace key while editing a file via nano, weird things happen - weird things that I can't really explain. Text just flies from one side of the screen to the next, your cursor starts deleting characters nowhere near where you want it to; it just doesn't work. Because of this, I've been using
vi (which I'm not a huge fan of but it gets the job done).
Luckily, thanks to GitHub user, tarobison, they discovered a loose solution on how to fix this. I've been able to apply this solution to each of my CentOS servers and have ran nano without any problems ever since. And the solution they proposed? Running
stty sane and
export TERM=linux after logging into your server.
But because ain't nobody got time to do that, all you need to do is simply add those commands to the
~/.bashrc file of the remote server you're connecting to via the following command:
echo -e "stty sane\nexport TERM=linux" >> ~/.bashrc
Once added, all you need to do is log out/in or source your ~/.bashrc file and you're good to go. Now anytime you log into the server you've added this to, nano will work just as you expect it to!