How to Edit File in Linux


If you’re new to the Linux running machine and wish to be told some fundamental issues, you’re in the proper position. This instructional is citing probably the most basic beginnings issues you will have to learn about.

How to edit a record whilst the usage of the Linux machine is the query that arrives in each novice’s thoughts. When executing systems on a machine, once in a while we wish to regulate them in a well timed way. You can carry out such duties thru two of essentially the most used editors’ i-e, nano editor, and vim editor.

Let’s take a look at how they paintings:

How To Edit File in Linux Through Nano Editor

Nano editor is an easy integrated editor in Linux distributions used to edit recordsdata. We don’t wish to be told a lot ahead of the usage of this, it’s easy. All the elemental operations with the symbols are discussed on the backside of the editor. You could make use of them with the “Control (ctrl)” key. There isn’t any pre-requisite of it or no command to function this.

To open nano editor, first take a look at its model the usage of command in terminal:

(If it isn’t put in on your machine; sort the next command to get it “$ sudo apt install nano”)

Simple sort “nano” with the record identify that must be edited within the editor. For instance, there’s a record in my machine identify “testing.txt”, to open it, sort:

To edit it, transfer the cursor the place you need so as to add required textual content and get started typing.

After amendment press “ctrl+o” keys to put it aside:

File amendment has been stored effectively. Now, press “ctrl+x” keys to go out the nano editor.

To check the amendment, open the terminal and run cat command with the record identify:

How To Edit File in Linux Through Vim Editor

The vim or vi editor is perhaps a integrated Linux editor that comes up with a couple of modes. Most of the equipment comprise one mode to edit paperwork. But whilst you get started operating with vim editor, you’ll get a number of such things as insert, command, line mode and lots of extra.

Before getting began with vim editor, you will have to know some fundamental symbols to modify mode:

  • “i” for insert mode
  • “w” to save lots of record
  • “Esc” for standard mode
  • “:q” to surrender editor with out saving
  • “:wq” to save lots of up to date file and give up editor

To take a look at which model is put in on your machine, sort in terminal:

Now, sort vim with the record identify to open it, as an example to open “test.txt” record, sort:

If there is not any “test.txt” record within the machine backup, then this command will create a brand new record of this identify.

Edit File: Now to edit the record, press “i”, it’ll turn on insert mode and permit you to upload the rest within the record.

Save File: Use the next “:wq” operation to save lots of an up to date record and give up the vi editor.


Editing a record or file is the most typical factor whilst the usage of any machine. Similarly, within the Linux running machine, you may want modifying always. Linux distributions include the a couple of integrated modifying equipment i-e, vim, and nano. This article has in short defined how you can edit recordsdata the usage of vim editor and nano editor.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More