Search code examples
macoscompilationterminal

How do I invoke a text editor from the terminal?


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.


Solution

  • There are plenty of ways. Try:

    1. vi <filename you want to save or open.cpp>,
    2. pico,
    3. Open /Applications/TextEdit.app <filename>.