Editing a file in Linux command-line can be done with three main commands: vi, nano, and vim.
1.vi:
vi is a well-known free text editor available on almost all Linux systems. It has two modes: command and insertion. To open a file with vi, type 'vi [file name]" on the terminal. To enter command/insertion mode, press the escape or control+c key. To save a file, use the command :w or :wq to save and quit, respectively.
nano:
Nano is another popular command-line editor which is easy to use. To open a file, type ' nano [file name]' on the command-line. To save a file, press control+x and type 'y'.
vim:
Vim is an advanced version of vi and is similar to it in terms of commands. To open a file, type 'vim [file name]' on the command-line. To enter command/insertion mode, press the escape or control+c key. To save the file, use the command :w or :wq to save and quit, respectively.
For more information about editing a file in Linux command-line, you may also check out this guide: https://www.ssh.com/ssh/vi/