Editing files
There are many text editors that can be used in Linux and Unix systems command line. Two of the most popular ones are nano and vim.
Nano
Nano is a simple, user-friendly text editor ideal for quick edits. It’s designed to be easy to use, especially for beginners. It provides an intuitive interface with on-screen shortcuts and basic text editing functions like cut, copy, paste.
Basic usage:
- Open/create a file:
nano filename - Edit text directly
- Save:
Ctrl+O - Exit:
Ctrl+X
Vim
Vim (Vi IMproved) is a highly configurable text editor built to enable efficient text editing. It has more powerful features than Nano but has a steeper learning curve. Vim uses a dual mode editing interface (normal and insert) that allow powerful search and replace capabilities.
Basic usage:
- Open/create a file:
vim filename - Enter insert mode: Press i
- Exit insert mode: Press Esc
- Save:
:win normal mode - Exit:
:qin normal mode - Save and exit:
:wqin normal mode