Dark background with blue accents with light reflectionsDark background with blue accents with light reflectionsDark background with blue accents with light reflections
[Mac OS X] Directing Command Line Output to a GUI Application

[Mac OS X] Directing Command Line Output to a GUI Application

[Mac OS X] Sending command line output to a GUI application

In the previous article, we looked at the possibilities of a command with a key for launching GUI applications. This command has another interesting key, with which it can take data from standard input (aka) and pass it to the default text editor.

So this can be used to get the output of any console commands by organizing a pipeline (aka , aka ) from their standard output (, aka ) to standard input (), from which the command can get it.

Experienced users have already understood everything, the first paragraph is enough for them and they now know how to do what is written in the title of the article, so they can read no further.

For those who are not familiar with the concepts , and , I will explain what has been said in a simpler and more understandable language, as well as give examples.

Standard input () in Unix-systems is the input stream from which commands come from the user, i.e. in our case, it is keyboard input.

Standard output () is the data output stream, to which the output of the command being executed is sent, i.e. in our case, it is the screen.

In other words, what is written in the first paragraph means that if you execute the command, enter any text from the keyboard, the input of which is completed with the combination Ctrl+D (this is a special combination - the input end command), then the typed text will open in the default text editor - standard TextEdit (pictures are clickable):

Now for the second paragraph. On Unix systems, you can pipe the standard output of one command to the standard input of another command by piping () between them. This means that we can organize the transfer of what some console command outputs to the command, which in turn can transfer all this to an application with a graphical interface.

A practical example. The command shows the contents of the current directory. Let's direct its output to a text editor:

The vertical bar is the very pipe () that redirects the output of the command to the input of the command. Result:

Try the command:

This will open the manual page () of the command in the test editor.

In this article, I described how to open guides () in the View application. Now you understand how the command from that article works:

Summary

does what is written in the title of the article. 🙂

I hope that this short lesson on the basic concepts of Unix-systems did not seem too complicated for beginners. 🙂

Learn how to trade online

School of Trading and Investing "ABTco Invest-School"

Learn to trade from zero • Investing in stocks • Fully Online learning

Just $27.00 for a full course

P. S.

If, nevertheless, something seemed incomprehensible, ask, I will try to explain in more detail.

Good luck!



Read this article in other languages: