How to edit a text file in Linux Redhat:
- Log into your Redhat server using PUTTY or similar application
- To open a file with the standard text editor type ‘vi’ at a shell prompt
- To add text, press ‘i’ (for Insert mode). This will allow you to make modifications
- To exit insert mode, press ‘Esc’, vi will revert to Normal mode
- To exit vi, press ‘:’ (which is the vi command mode) and press ‘q’ then ‘Enter’
- If you have made changes to the text file that you want to save, press ‘:’ and type ‘w’ then ‘q’ to write your changes to the file and exit the application
- If you accidentally made changes to a file and you want to exit vi without saving the changes, type ‘:’ and then type ‘q’ followed
by ”, which exits without saving changes.
More information about using vi can be found by typing ‘man vi’ at a shell prompt.
Tags:
Linux