- What is Nano
- What is Vim
- Temporarily change the editor to Nano
- Permanently set Nano as the default editor
- Step 1 – Create or edit your profile file
- Step 2 – Add the variables
- Step 3 – Start a new session
- Systemwide setting (servers you administer)
- Ionos 1&1 shared hosting – what works reliably
- Additional tips and useful details
- FAQ
- Glossary
If you work over SSH on a web or shared hosting server, you may run into this common situation: you type crontab -e and the system opens Vim or Vi instead of Nano. If you prefer Nano because it is simpler and has no modes, this can slow you down. This guide shows how to switch the default editor to Nano both temporarily and permanently on typical Linux systems and on Ionos (formerly 1&1) shared hosting. You will also find tips, gotchas and a short reference for Vim.
What is Nano
Nano is a lightweight, user friendly terminal editor. It uses straightforward shortcuts like Ctrl+O to save and Ctrl+X to exit. For quick edits of config files or cron jobs it is often the fastest choice.
What is Vim
Vim (Vi Improved) is a powerful editor with a modal workflow. That power comes with a learning curve. These basics help you exit and save if you land in Vim by accident:
| Action | Keys | Description |
|---|---|---|
| Switch to command mode | Esc | Leave insert mode |
| Save file | :w + Enter | Write file to disk |
| Save and quit | :wq + Enter | Write and exit |
| Quit without saving | :q! + Enter | Exit and discard changes |
| Quit if unchanged | :q + Enter | Exit if no edits were made |
If you prefer Nano, changing the default editor is the easiest fix.
Temporarily change the editor to Nano
Use this when you only want Nano for a single command or a single session.
export EDITOR="/usr/bin/nano"
export VISUAL="$EDITOR"
crontab -e
Short one-liner for a single run:
EDITOR=nano crontab -e
crontab -e checks VISUAL first, then EDITOR. If set, Nano opens just for that call.
Permanently set Nano as the default editor
Set environment variables in a shell startup file so every new SSH login picks Nano automatically.
Step 1 – Create or edit your profile file
Open your profile file in your home directory:
nano ~/.profile
If you use Bash and .profile is not read, try ~/.bash_profile. For Zsh users, prefer ~/.zprofile.
Step 2 – Add the variables
Append these lines at the end:
export EDITOR="/usr/bin/nano"
export VISUAL="$EDITOR"
If Nano lives elsewhere on your system, adjust the path. Check with which nano.
Step 3 – Start a new session
Log out and back in or open a new SSH session. Verify:
echo $EDITOR
echo $VISUAL
The output should be /usr/bin/nano or nano. Now crontab -e should open Nano.
Systemwide setting (servers you administer)
If you have root, you can set the default editor for all users:
sudo nano /etc/profile.d/nano.sh
Add:
export VISUAL="nano"
export EDITOR="nano"
This applies to new logins for every user.
Tip for Debian and Ubuntu servers you manage yourself: you can also run sudo update-alternatives --config editor to pick Nano as the system default editor. This is not available on most shared hosting plans.
Ionos 1&1 shared hosting – what works reliably
On Ionos shared hosting with SSH, .profile in your home directory is the most dependable place to set the variables.
- Log in via SSH to your hosting account.
- Go to your home directory:
cd ~. - Edit your profile file:
nano ~/.profile. - Add:
export EDITOR="/usr/bin/nano"export VISUAL="$EDITOR"
- Save with Ctrl+O, Enter and exit with Ctrl+X.
- Log out and back in. Run
crontab -eto confirm that Nano opens.
Notes for shared hosting:
- Some providers do not read
.bashrcor.bash_profilefor login shells..profileis usually read. - On accounts with restricted shells, shell startup behavior may differ. If nothing changes, check which shell you are in with
echo $SHELL.
Additional tips and useful details
- Identify your shell – run
echo $SHELLorps -p $$ -o comm=. This tells you which startup file is likely used. - Root vs user crontab –
sudo crontab -euses root’s environment. Your user’sEDITORandVISUALwill not apply unless you also set them for root. You can force it once withsudo EDITOR=nano crontab -e. Forvisudo, usesudo EDITOR=nano visudo. - Backup before edits – keep a copy of your profile file:
cp ~/.profile ~/.profile.bkp. - Effects beyond crontab – many tools respect
EDITORorVISUAL. Examples includegit commit,vipw,visudoand various maintenance scripts that open an editor. - Cron job environment – cron runs with a minimal environment. Setting
EDITORhelps for editing withcrontab -e, but variables you want inside cron jobs should be set explicitly in the crontab or sourced from a script. - Check Nano installation – verify with
which nanoandnano -V. If Nano is missing, install it on servers you manage. On shared hosting you cannot install packages, so rely on what the provider offers.
FAQ
Why do I still get Vim after editing .profile
Common reasons: you did not start a new login shell, the shell reads a different file, or you edited the file for the wrong user. Also check the path to Nano and confirm the variables with echo $EDITOR and echo $VISUAL.
Can I make the change without touching profile files
Yes – prefix a single command with EDITOR=nano or export the variables for the current session only.
Does this affect Git and other tools
Yes – most command line tools that open an editor will prefer VISUAL and EDITOR. After this change they will open Nano.
What about sudosudo usually runs with a clean environment. For one-off edits you can do sudo EDITOR=nano command. If you want persistent behavior for root, set the variables in root’s environment or use update-alternatives on servers you control.
Which file should I edit on Zsh
Use ~/.zprofile for login shells on Zsh. You can also set the variables in ~/.zshrc for interactive shells. Behavior depends on how your session is started.
Glossary
EDITOR – environment variable used by many tools to decide which editor to run.
VISUAL – similar to EDITOR but often takes precedence.
crontab -e – command that opens your user’s cron table for editing.
Shared hosting – multiple customer accounts share one server with limited privileges.
SSH – secure remote shell for command line access.
Shell – program that interprets commands, for example Bash or Zsh.
Home directory – your personal directory on the system, for example /home/username.
Vim modes – Normal mode for commands and Insert mode for typing text.