That is VIM (or possibly another vi
clone). You are in a text editor. To add a cron job, just edit using that editor.
You do not have select-editor
because that is part of the "sensible-utils" package on Debian. (Previously it was part of a "debianutils" package which was more obviously Debian-specific.) That package is in the EPEL, not in CentOS proper.
The thing that RedHat has adopted from Debian is the "alternatives" system. That controls what the editor
command maps to.
There are several possibilities:
- Your
VISUAL
environment variable points to vim
(or vi
).
- Your
VISUAL
environment variable points to editor
, and the currently selected alternative for editor
is VIM.
- Your
VISUAL
environment variable is unset, the fallback is editor
, and the currently selected alternative for editor
is VIM.
- Your
VISUAL
environment variable is unset, the fallback is vim
(or perhaps vi
).
There are two approaches to changing the editor, if you want to use another one:
- Change what your
VISUAL
environment variable points to. Depending from how you set it in the shell, this changes full-screen editor for just the current interactive shell session, or even just the current command (if you assign the variable as a prefix to a simple command). You can of course set it in a login script.
- Unset your
VISUAL
environment variable and change the alternative for editor
. This changes the meaning of editor
for everyone on the system, note. It also depends from the assumption that editor
is the fallback when the environment variable is unset. That's a reasonable fallback to use on "alternatives" operating systems like Debian, OpenSUSE, and Fedora/CentOS/RHEL. But the fallback logic is of course encoded in many individual commands and scripts and not every software author chooses editor
as the fallback.
Further reading
VISUAL or EDITOR environment variables
(fromman crontab
)? – RudiC Feb 05 '20 at 10:10VISUAL
orEDITOR
env. variable prior to run crontab -e. Here's e.g. how:EDITOR=mcedit crontab -e
. This will use midnight commander editor. Replace it with the one of your choice. – Tagwint Feb 05 '20 at 10:35:
,q
andEnter
to get out of thevim
editor you're in. Or if you had already pressed thei
,a
ors
keys by mischance,Escape
,:
,q
,!
andEnter
. – Feb 05 '20 at 14:33