How do I invoke a text editor from the terminal?

Ceetang picture Ceetang · Feb 23, 2012 · Viewed 196.7k times · Source

In the Windows command prompt, I can type notepad helloworld.cpp which will then create a .cpp file with the name helloworld and open up Notepad for me.

Is there a similar function for Mac Terminal, preferably with Textmate or Textedit?

I'm running Mac OS X Lion 10.7, with Xcode developers tool.

Answer

Vito Gentile picture Vito Gentile · Feb 11, 2014
open -e <filename>

The option -e is used to open the file <filename> with TextEdit.