

$ ls -l ~ | open -tf # default application assigned to txt You can even pipe text into open with the -f option: $ ls -l ~ | open -f # TextEdit, '-e' is implied (Many text editors, like BBEdit and Atom, have their own CLI tool, but if they don’t, you can use open -t instead.) In the default macOS config these are the same, but you can of course change the default app to your favourite text editor. txt file extensions) You can use the Finder Info panel to change the default application or, if you want more fine grained control use RCDefaultApp. Will open a file with the default application for text files (. There are two interesting special cases for designating applications: $ open -e helloworld.swift If you want to open a document but keep the application and the new document window in the background, use the -g option. If you need to be specific, you can also specify an application’s bundle identifier with -b.
#Mail application for mac 2017 full#
You can specify just the name of an application or the full path, i.e. If you have changed the default application that handles a file type or want to override the default application, you can use the -a option: $ open -a Preview ~/Desktop/Screen\ Shot\ *.png Will open all screenshot files (if any) in a viewer in the default application (Preview).

You can use this against multiple files as well: $ open ~/Desktop/Screen\ Shot\ *.png
#Mail application for mac 2017 pdf#
Will open document.pdf in the current working directory with the default application for PDF files (usually Preview). In general you can think of open as the command line equivalent of double-clicking a file or folder in Finder. Or you can use the keyboard short cut ⌘⌥W. To clean up, you can option-click any close button in a Finder window to close all Finder windows. You can also open multiple folders at once: $ open ~/Documents ~/Desktop ~/Downloads This can be used as a quick way to navigate to hidden directories. Trivially, it cannot merely open the current working directory, but any path: $ open ~/Library/Preferences However, the open command can do so much more. (You, dear wonderful reader, know this because you read my previous post on Terminal-Finder Interaction.) Will open the current working directory in a Finder window. Most Terminal users will know that $ open. You can learn more about using Terminal and the shell on macOS in my my book: “ macOS Terminal and Shell” - Thank you!
