DISCOVER
×

How to edit file in centos

Updated July 20, 2017

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.

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.

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.

bibliography-icon icon for annotation tool Cite this Article

Resources

About the Author

Kristen Waters has been writing for the computer industry since 2004. She has written training materials for both large and small computer companies as well as how-to and informative articles for many online publications. She holds Bachelor of Science degrees from both York College of Pennsylvania and the University of Maryland.