Vim can’t open file for writing error is considered one of the most typical and frequent errors you’ll encounter, when you use Linux and vim editor. Whether you’re a novice or Pro Linux consumer, “E212” is the error code, you don’t like seeing. Most of the time, this error occurs due to inadequate rights or a directory path or file that doesn’t exist, which you are attempting to edit. In this publish, I will let you know all the reasons and solutions to repair the “Vim can’t open file for writing” error. It requires your sudo account password to write down the file contents and save the file in the mentioned path. Enter your root passcode and hit the “Enter” button.

When you get into this place, and it will write the file utilizing sudo. Listing the recordsdata in the listing reveals the brand new file practice that you just created. If your gadget is mounted as read-only, run the next command to re-mount it with the proper permission.

File might be overwritten with buffer contents in vi. Vi will then detect that changes have been made to file and will immediate if you want to reload the file again. It will write contents of buffer in vi to plain output and to file specified by ‘%’. One of the common cause for the error is that the fstab is a read-only file.

Browse other questions tagged linux vim sudo or ask your personal query. I try to write a file that needs sudo privilege, but I did not add sudo beforehand. The Vim information had been principally the same as in Windows, however they use a special technique for getting file info. In the Windows version, the Write a file home windows are named as Wmf information, and the Vim version as Vim information.

Recently one of many customer contacted us saying we’re unable to edit the fstab file. On analyzing the file, write permission was available for the file. Thus, if fstab doesn’t have the required permission or if an immutable attribute is ready this error occurs. If we add a new onerous disk or to partition the prevailing one. By default, to read-only is offered for strange users as a security measure. This means primarily you forgot to include the sudo command earlier than opening the file in question.

So, we’ve to make use of the sudo apt command to take action. Try the beneath command to put in it in your system. It will want your root account passcode to initialize the method of installation. Enter your sudo password and hit the “Enter” button to continue. You will see that it is going to start putting in and downloading Vim utility along with different bundles.

To repair it, you must edit this file using sudo permissions. Run the following command to edit this file successfully. Let me show you an example, attempt enhancing what kind of energy involves the flow of positive charges /etc/apt/sources.list with a non-root person and you’ll perceive, what I am making an attempt to prove right here.

Write the below give up command and hit the important thing “Enter” to return again in the terminal shell. After the installation of Vim, you probably can verify its information by utilizing the same command as under. You will have to have Linux distribution put in and configured in your machine. In our case, we now have Ubuntu 20.04 Linux distribution. On the other hand, you should have sudo rights to use the Linux system and Vim utility. We will maintain your servers secure, secure, and fast at all times for one mounted worth.

Sophia Jennifer

I'm Sophia Jennifer from the United States working in social media marketing It is very graceful work and I'm very interested in this work.