How to open and edit a file on the command line? I tried using the command open:
open
sudo open -e /etc/apache2/extra/httpd-vhosts.conf
but the file Locked, and I can’t change anything.
Locked
I need to edit a lot of text and use nanoor vimnot very convenient.
nano
vim
I suspect this is due to the fact that the resolution is for the command open, and not just for TextEdit.
, , SublimeText (sudo subl /path/to/file) TextMate (sudo mate /path/to/file). vi nano:-)
sudo subl /path/to/file
sudo mate /path/to/file
vi
, TextEdit, , , .
- , :
cp /etc/apache2/extra/httpd-vhosts.conf ~/httpd-vhosts.conf open ~/httpd-vhosts.conf sudo mv /etc/apache2/extra/httpd-vhosts.conf /etc/apache2/extra/httpd-vhosts.conf.bkup sudo mv ~/httpd-vhosts.conf /etc/apache2/extra/httpd-vhosts.conf
sudo open -a TextEdit /etc/apache2/extra/httpd-vhosts.conf