A quick tip for GNU Nano – the text editor. Ever receiving the terminal error when using nano?
[root@srv ~]# nano
Error opening terminal: unknown.
Under chroot or container (like docker) environment try exporting the TERM environment:
And then execute nano the chances are you will enter nano normally and do your work (faster than vim 🙂 )?
You may use it without exporting to your shell, but just the for the nano:
Ever wondered how to change your text editor when editing text files in Linux? Here is a newbie tip!
For example if you when you what to edit cron jobs you execute
[srv@local ~]# crontab -e
And you get in a text editor? Probably you like vim or nano or pico or some other text editor? and you want to use it whenever the system needs a text editor?
There is an environment variable EDITOR, which could be set to one of the text editors mentioned above.
Temporary you could do it from the command line for the current session to open text files with “nano”
[srv@local ~]# export EDITOR="nano"
And when you open to edit cron jobs or edit a text file in “mc” or whenever the system needs a text editor it will use “nano”. If you replace “nano” with other editor it will be used.
To make it permanent you must put it in your current .bashrc file – “/home//.bashrc” (or more accurate “~/.bashrc”). Just add the same line as above at the end of your .bashrc file:
And if you check your current environment you’ll see there is a variable named EDITOR:
[srv@local ~]# env|grep EDITOR