You're replying to a comment by Jason.

Jason Permalink
April 23, 2010, 20:22

#3 is great -- I am always trying to edit files in /etc and forgetting to become root or use sudo.

But, based on your explanation, I'm not sure why the following doesn't work:

:w !sudo cat > %

It seems that should also be able to write to the file, but I get a permission error when I try it

:w !sudo cat > %
/bin/bash: /tmp/root.txt: Permission denied

shell returned 1

Any ideas?

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "linux_195": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.