How to Edit File in CentOS

Save

CentOS is a free, open source, Enterprise class Linux distribution which was created using the RedHat Enterprise Linux source code. The majority of the CentOS operating system is exactly the same as the RedHat distribution. Linux configuration files are usually plain text files that can be edited in any text editor. The default command line text editor for CentOS is the Vi text editor. The default graphical text editor is gedit in the Gnome desktop environment and Kate in the KDE desktop environment. You can use any of these text editors to edit plain text files.

Command Line

  • Click on the "Terminal Quick Launch" button in the panel at the bottom of the screen.

  • Type the command "vi filename" to open the file in the Vi text editor. Replace "filename" with the name of the file that you want to edit.

  • Use the "j" (down), "k" (up), "h" (left) or "l" (right) keys to navigate through the document.

  • Press the "i" key to insert text before the cursor. Press the "a" key to insert text after the cursor. Press the "R" key to replace characters. Press the "x" key to delete characters.

  • Press the "ESC" key to return to the Command mode and continue to navigate through the document.

  • Type ":wq" to save and close the document.

Graphical Method

  • Double-click on the file that you want to edit. The file will open in either the Gedit (Gnome) or Kate (KDE) text editor, depending on the desktop environment you are using.

  • Use the mouse to navigate through the text file.

  • Use the keyboard to insert, delete and modify the text.

  • Click on the "Save" option under the "File" menu to save the file.

  • Click on the "X" in the upper right corner of the screen to close the file.

References

Promoted By Zergnet

Comments

Resources

You May Also Like

Related Searches

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!