Last Updated: February 25, 2016
·
415
· robjens

Quick and easy file write as root

While I was switching from rvm to rbenv I removed the system Ruby as part of it and, for a few moments had a vim refusing duty since it relied on the ruby .so library which wasn't there anymore and I wanted to write something without too much effort as root:

sudo su -c 'cat <<eof > /etc/locale.conf
    LANG=en_US.UTF-8
    LC_COLLATE=C
eof'

Did just the trick. It has the convenience of heredocs, so its a nice editing experience in bash as well (of course my zle is superior, but that's another story ;)