This is limited to what is shown in the window, but can also be used only for selected text. In the "Shell" menu, select the "Export Text As." option to save the text in the Terminal window to a file. You can also drag highlighted text to a Finder folder where it will be saved as a text clipping that can be inserted into a number of applications. Use the mouse to select the contents of the Terminal window that you wish to save, and then copy it to a TextEdit or other editor's window. For instance, to save the listing of a directory to a file in the user's home directory (designated by the "~/" symbols), one would enter the following command: Using the greater-than symbol (>) you can save the output of any command to a file. This can be done several ways, some of which may be more convenient than others for various tasks.Ī commonly used Unix trick is to redirect the output of a command to a file. Periodically you may wish to save the output of commands as seen in the Terminal window. Escaped text can be useful when pasting bodies of text into code. To do this, copy your text as usual, and press control-command-V (or select "Paste Escaped Text" from the Edit menu) to paste it into the terminal. This can be mundane work, so the Terminal has a feature to paste text and introduce backslashes before commonly "escaped" characters. If you are copying and pasting large bodies text into code in the terminal that you wish to keep intact and not have characters interpreted as code, you will have to escape symbol characters using a backslash before them. When coding, special characters like quotes, brackets, and other symbols may be interpreted as code. If you are a regular Terminal user, because it is basically a window under the hood of OS X you may find yourself focused on the active shell and overlooking a number of features the Terminal application itself has to offer. The Terminal is a widely used application for getting to the OS X underpinnings, and we frequently recommend using it to tackle small problems in OS X.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |