- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Specify an Editor for Crontab on Linux
The default editor for crontab on Linux is the vi editor. However, this can be changed by setting the VISUAL or EDITOR environment variable to the desired editor before running the crontab command. For example, to use nano as the editor for crontab, the command would be −
export VISUAL=nano; crontab -e
export EDITOR=nano; crontab -e
This will open the crontab file in nano for editing.
Editor in Linux
An editor in Linux is a program that allows users to create, view, and modify text files. There are many different text editors available for Linux, each with their own set of features and functionality. Some popular text editors for Linux include −
vi/vim − a powerful and highly configurable text editor that is often included with Linux distributions by default.
nano − a simple and easy-to-use text editor that is often used as a default editor for new Linux users.
emacs − a highly customizable text editor with a large user base and a wide range of features.
gedit − a text editor with a graphical user interface (GUI) that is often included with the Gnome desktop environment.
Sublime Text − a proprietary, cross-platform text editor with a large user base and a wide range of features.
In addition to these text editors, there are many other options available, including command-line based editors like joe, jed, ed, and more and GUI based editors like Atom, Visual Studio Code, etc.
Default Editor in Linux
The default editor in Linux can vary depending on the distribution and the system settings.
Some Linux distributions, such as Ubuntu, use nano as the default editor for command-line based tasks.
Other distributions, such as Red Hat or Fedora, use vim (vi-improved) as the default editor.
However, it's also possible to change the default editor by setting the VISUAL or EDITOR environment variable. For example, if you want to use nano as the default editor, you can add the following line to your .bashrc file −
This will make nano the default editor for all command-line based tasks that use the VISUAL or EDITOR environment variable.
The command select-editor is a command line utility in some Linux distributions that allows the user to interactively select the default command line editor. The selection will be stored in the VISUAL and EDITOR environment variables, so that it becomes the default editor for all command line based tasks that use those variables.
It can be used by running the command select-editor in terminal, it will then present you with a list of available editors and you can select the one you prefer.
For example, in Ubuntu, you can use the select-editor command to change the default editor to nano, by selecting it from the list.
sudo update-alternatives --config editor
This command will show you a list of available editors on your system and ask you which one you would like to use as the default.
Keep in mind that this command may not be available in all distributions.
In conclusion, the default editor in Linux can vary depending on the distribution and system settings. Some popular text editors for Linux include vi/vim, nano, emacs, gedit, and Sublime Text. The default editor can be changed by setting the VISUAL or EDITOR environment variable, or by using the select-editor command (if available in the distribution). It's important to note that the availability of the command select-editor may vary depending on the Linux distribution you are using.
Kickstart Your Career
Get certified by completing the courseGet Started