Vim is keyboard-driven, ultra-fast, and lightweight, making it ideal for coding and scripting. Unlike GUI editors, it requires minimal system resources, making it efficient even on older machines.
These are command-line based text editors that allow you to create and modify files directly within the terminal.
Nano is known for its simplicity and user-friendly interface, making it a great choice for beginners.
-
Open a file in Nano:
nano filename.txt
-
Saving and Exiting:
- Press
CTRL + Xto exit. - If you've made changes, you'll be prompted to save. Press
Yfor Yes orNfor No. - If you choose to save, you'll be asked for the filename (you can usually just press
Enterto keep the existing name).
- Press
Vim is a powerful and highly configurable text editor favored by many developers and system administrators for its efficiency and extensive features. It has a steeper learning curve than Nano.
-
Open a file in Vim:
vim filename.txt
-
Basic Editing:
- Press
ito enter Insert Mode, where you can type text. - Press
ESCto exit Insert Mode and return to Normal Mode (command mode). - In Normal Mode, you can use various commands to navigate, edit, and save the file.
- Press
-
Saving and Exiting:
:wfollowed byEntersaves the file.:qfollowed byEnterquits Vim.:wqfollowed byEntersaves the file and then quits.:q!followed byEnterquits without saving changes (use with caution).