How to edit a file from the command line Mac OS X?

Ihor Tkachuk

How to open and edit the file in the command line? I tried to use the command open:

sudo open -e /etc/apache2/extra/httpd-vhosts.conf

but the file is Locked and I can not change anything.

enter image description here

I need to edit a lot of text and use nano or vim is not very convenient.

prodigitalson

I suspect this is because the permission elevation is for the open command, not TextEdit itself.

You should use a different editor that can have its binary run properly from the command line like SublimeText (sudo subl /path/to/file) or TextMate (sudo mate /path/to/file). Or just suck it up and use vi or nano :-)

If you're going to be doing a lot of this type of thing TextEdit is probably the least desirable editor to use anyhow.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Execute "Get Info" on a file from command line in Mac OS X

From Dev

How to add user to a group from Mac OS X command line?

From Dev

Finding all not responding tasks from the command line in Mac OS X?

From Dev

How to start Emacs For Mac OS X from the command line without blocking?

From Dev

How to install single package from metapackage through a command line in Mac OS X?

From Dev

Edit bootable img file on Mac OS X

From Dev

Mac OS X architecture and command line

From Dev

How to Send the Contents of a Text File to the Clipboard from the Command Line in OS X?

From Dev

Opening a new terminal from the command line and running a command on Mac OS X?

From Dev

How to read file from the command line on Mac terminal for Python

From Java

How to open Atom editor from command line in OS X?

From Dev

How to edit a config file using the command line?

From Dev

How to edit the hadoop.env.sh file through terminal on Mac OS X 10.9.5

From Dev

How can I type text from a file on Mac OS X?

From Dev

How to edit pdf metadata from command line?

From Dev

How to edit pdf metadata from command line?

From Dev

-nographics alternative for Mac OS X when running Unity3d from the command line?

From Dev

Can I boot to a different Mac OS X partition from the command line?

From Dev

How can I bundle a command line utility in os x application on Mac App Store (using sandbox entitlement)

From Dev

How to create my own "shell" command line program in Mac OS X

From Dev

Open a new file from command line on os/x using default application for the file type

From Dev

Package a command line script in a Mac OS X pkg

From Dev

Add/import certificate with password via command line Mac OS X

From Dev

Xcode 6.1 Mac OS X new project for command line tool

From Dev

Add/import certificate with password via command line Mac OS X

From Dev

command line terminal in mac os x shows wrong version of Java

From Dev

Command-line application for converting SVG to PNG on Mac OS X

From Dev

Running command line app in the background using launchagents mac os x

From Dev

Remap Keys via Command Line in Mac OS X

Related Related

  1. 1

    Execute "Get Info" on a file from command line in Mac OS X

  2. 2

    How to add user to a group from Mac OS X command line?

  3. 3

    Finding all not responding tasks from the command line in Mac OS X?

  4. 4

    How to start Emacs For Mac OS X from the command line without blocking?

  5. 5

    How to install single package from metapackage through a command line in Mac OS X?

  6. 6

    Edit bootable img file on Mac OS X

  7. 7

    Mac OS X architecture and command line

  8. 8

    How to Send the Contents of a Text File to the Clipboard from the Command Line in OS X?

  9. 9

    Opening a new terminal from the command line and running a command on Mac OS X?

  10. 10

    How to read file from the command line on Mac terminal for Python

  11. 11

    How to open Atom editor from command line in OS X?

  12. 12

    How to edit a config file using the command line?

  13. 13

    How to edit the hadoop.env.sh file through terminal on Mac OS X 10.9.5

  14. 14

    How can I type text from a file on Mac OS X?

  15. 15

    How to edit pdf metadata from command line?

  16. 16

    How to edit pdf metadata from command line?

  17. 17

    -nographics alternative for Mac OS X when running Unity3d from the command line?

  18. 18

    Can I boot to a different Mac OS X partition from the command line?

  19. 19

    How can I bundle a command line utility in os x application on Mac App Store (using sandbox entitlement)

  20. 20

    How to create my own "shell" command line program in Mac OS X

  21. 21

    Open a new file from command line on os/x using default application for the file type

  22. 22

    Package a command line script in a Mac OS X pkg

  23. 23

    Add/import certificate with password via command line Mac OS X

  24. 24

    Xcode 6.1 Mac OS X new project for command line tool

  25. 25

    Add/import certificate with password via command line Mac OS X

  26. 26

    command line terminal in mac os x shows wrong version of Java

  27. 27

    Command-line application for converting SVG to PNG on Mac OS X

  28. 28

    Running command line app in the background using launchagents mac os x

  29. 29

    Remap Keys via Command Line in Mac OS X

HotTag

Archive