
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
The open-cli npm package allows you to open files, URLs, or applications using the command line. It is a simple and efficient tool for automating the opening of various resources directly from the terminal.
Open a URL
This feature allows you to open a URL in the default web browser. The code sample demonstrates how to open Google's homepage.
open-cli 'https://www.google.com'
Open a file
This feature allows you to open a file with the default application associated with its file type. The code sample demonstrates how to open a text file located at a specific path.
open-cli './path/to/file.txt'
Open an application
This feature allows you to open an application by its name. The code sample demonstrates how to open the Calculator application.
open-cli 'Calculator'
The opn package is similar to open-cli in that it allows you to open files, URLs, or applications from the command line. However, opn is more focused on being a programmatic API for opening things, whereas open-cli is more command-line oriented.
The open package is another alternative that provides similar functionality. It is a more modern and actively maintained package compared to opn. It also offers more options and flexibility for opening files, URLs, or applications.
Open stuff like URLs, files, executables. Cross-platform.
npm install --global open-cli
$ open-cli --help
Usage
$ open-cli <file|url> [--wait] [--background] [-- <app> [args]]
$ cat <file> | open-cli [--extension] [--wait] [--background] [-- <app> [args]]
Options
--wait Wait for the app to exit
--background Do not bring the app to the foreground (macOS only)
--extension File extension for when stdin file type cannot be detected
Examples
$ open-cli https://sindresorhus.com
$ open-cli https://sindresorhus.com -- firefox
$ open-cli https://sindresorhus.com -- 'google chrome' --incognito
$ open-cli unicorn.png
$ cat unicorn.png | open-cli
$ echo '<h1>Unicorns!</h1>' | open-cli --extension=html
The following file types are automagically detected when using stdin mode.
FAQs
Open stuff like URLs, files, executables. Cross-platform.
The npm package open-cli receives a total of 164,873 weekly downloads. As such, open-cli popularity was classified as popular.
We found that open-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.