Conor Mac Aoidh wrote:
> Hi,
>> This is my first time sending an ilug email. I am pretty much a complete
> newbe to linux. I just had a question as to using the VIM command. I am
> trying to use this to create a new file in a new directory. It keeps
> returning the error "E212: Can't open file for writing" and after googleing
> the error it turns out that I do not have enough privilages to do what I
> want to do. I am logged in as root. Does anyone know how I can get the
> privileges that I need? Or can anyone recommend another method of achieving
> what I want do do - as i'm not sure if VIM should even be used for this
> purpose!
>> Thanks
>
Hi Conor,
Others have pointed out that the issue is likely related to permissions
so the answer lies outside of vim. One simple way to test this is to use
the "touch" command. The touch command takes a filename as an argument,
and attempts to create an empty file of that name. If it fails, then you
have a permission issue. If not, you have a vim issue.
In general, something like
$ touch /home/fred/somefile.txt
will succeed if you have write access to /home/fred (and if /home/fred
actually exists). Of course, like most Unix commands, it won't tell you
that it succeeded, it will complain if it fails though.
Thomas suggested that you might be using sudo. If this is the case, then
use sudo with the touch command also, which would look like:
$ sudo touch /home/fred/somefile.txt
Finally, I personally consider vim to be easy to *use*, just hard to
learn:) You might find this short summary useful while you're still
getting used to it:
http://fiachra.ucd.ie/~philb/VI_Summary.pdf
-Phil
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!