How can I write on my computer screen or open an application like notes and write on it from Terminal??
I can open up notes or any other app/document.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Terminal is a CLI, or Command Line Interface, and notes and other text editor apps that you are familiar with are part of the GUI family, Graphical User Interface. The GUI is most likely the type of interface you interact with every day.
That being said, you cannot open and run a GUI app in a CLI. If you open up myapp.app from Terminal, it will open it up as a GUI. For example, you can't open up Safari in terminal, do a google search from the command line, and then watch a video. However, there are a few CLI text editors that would be similar to notes already installed on your computer. My favorite is vi.
Open your terminal, and type
vi after the prompt. A new interface should appear with a description of vi. I'll post a link to all the commands in vi at the end of my post, but I'll go over a few of the essential ideas.
No mouse. It's 100% a CLI, meaning you can't use the mouse for anything. Instead, use the arrow keys.
With that in mind, when you enter vi you are in command mode. We'll talk more about that in a second. To add text, you have to enter insert mode, which is done by typing
i+return. Now you are in insert mode and you can type whatever you want.
Command mode: When you are done typing, you're going to want to save your file most likely. To do this, you must enter command mode. Press the escape key. Then type:
:wq filename+return. This saves a new file called filename. Keep in mind it saves to the current directory you are in. To fully exit and save, type :wq
You can even change the standard output to make it viewable in the GUI:
filename > filename.txt
Then, you can open filename.txt in textedit, or any other GUI text editor.
One last cool feature of vi, is it lets you edit current ASCII files anywhere on your computer. Just type
vi filename in the prompt.
An extremely easy way to edit text in the command line that doesn't require a significant investment of time to learn is nano.
nano foo opens foo if it exists in the directory or a blank file if it doesn't.
You navigate the cursor using your arrow keys, and use control+o to save(enter to confirm filename)
and control+x to close.
The best news is that you don't have to memorize these commands because they are all displayed at the bottom of the terminal window while you are using nano.