Open

open

Open a file, directory, or URL using the platform-appropriate opener command: xdg-open (Linux), open (macOS), start (Windows/Cygwin). Named open() by deliberate convention — the same verb used on macOS and Windows, and by xdg-open on Linux. Detected once at source time; on macOS the native open(1) is used as-is.

Example

open report.html
open /etc/hosts
open "https://example.com"

Arguments

  • $1 (string): File path, directory, or URL to open

Exit codes

  • 0: Opened; 1 No suitable opener found; 2 Missing argument