others-how to open file with specified app in command line on mac osx system ?

1. Purpose

In this post, I demonstrated how to . That’s it, thanks for your reading.

2. Solution

If we want to open 2022.md with sublime text application, we can do this:

open -a "sublime text" 2022.md


or you can create an alias for above command as follows:


alias mdopen='open -a "sublime text"


then just use the shortcut command:

  mdopen 2022.md



3. The theory

Let’s see the options that provided with open command:

Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s ][-b ] [-a ] [filenames] [--args arguments]

Help: Open opens files from a shell.

  By default, opens each file using the default application for that file.
  If the file is in the form of a URL, the file will be opened as a URL.

Options:

  -a                Opens with the specified application.



3. Summary