cmd line tutorials - gencmd

cmd line tutorials - gencmd

The open Command

Unix-Linux Mac

The open command opens a file or application.

Syntax

The basic syntax for the open command is as follows:

open [options] <file>

The <file> argument is the path to the file or application that you want to open. If you do not specify a path, the open command will open the default application for the file type.

The [options] argument is a list of options that can be used to modify the behavior of the open command.

Examples

Open the file “myfile.txt” in a text editor.

open myfile.txt

Open the image file “myimage.jpg” in an image viewer.

open myimage.jpg

On Mac, you can open an mp4 specifically in Vlc.

open -a Vlc.app

With gencmd

gencmd -c open open a file in Google Chrome app

  • open -a Google\ Chrome.app <file>
  • open -a “Google Chrome.app” file