Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I save a VI file after entering data? [closed]

Tags:

file

linux

vi

I am new to linux, when I typed "vi FILE1" I was able to open VI editor. I added some data and I want to save the file and I tried :w but it threw me an error.

"file1" E212: Can't open file for writing Press ENTER or type command to continue

why I am not able to save it?

The directory in which I am creating file has following permissions:

drwxr-xr-x 4 pentaho pentaho 4096 Mar 12  2013 master

I am logging using root user and password.

Output of mount command :

/dev/sda1 on / type ext4 (rw)

    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/sdb1 on /etl type ext4 (rw)
    /dev/sdc1 on /oracle type ext4 (rw)
    /dev/sdd1 on /export type ext4 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
like image 597
Megha Sharma Avatar asked Apr 30 '14 02:04

Megha Sharma


People also ask

How to save a VI file in Linux?

How To Save A Vi File Linux? If you want to save a file, you must first have it in Command mode. When you press Esc in Command mode, typing :wq to write the will be the easiest method. By pressing ZZ you will access the next writing method quicker. When the vi in non-vi is initiated, write is done as usual, and quit is done.

How do I save and exit at the same time Vim?

Once you have modified a file, press [Esc] shift to the command mode and press :w and hit [Enter] as shown below. Save File in Vim. To save the file and exit at the same time, you can use the ESC and :x key and hit [Enter]. Optionally, press [Esc] and type Shift + Z Z to save and exit the file.

How to overwrite a read-only file in vi text editor?

Overwriting a read-only file, or a file that already exists. The command sequence for saving a file in the vi text editor is as follows: Pressing Esc exits any editing mode.

How do I stop a file from playing in Vim?

Use Linux or Unix to open the terminal application. You may then choose the name of the file in vim / vi. Ctrl and C keys should be used to open an opened file in Vim / vi. The first way is to hit Enter key, then press Esc key and type:x in order to stop it from playing until it is turned off.


1 Answers

You can also get this error if the directory you are trying to save to does not exist. Even the root user will get this error.

like image 200
Walker Rowe Avatar answered Sep 28 '22 07:09

Walker Rowe