open - Linux


The open command in Linux is used to open a file (or files) in the user’s preferred application. It acts as a bridge linking the command-line interface with graphical user interface applications, allowing for the opening of files or URLs directly from the terminal. This command is most effective when used within scripting or when quick access from the command line to a GUI-based application is necessary.


The basic syntax for the open command is as follows:

open [options] file...
  • file...: One or more files or URLs to be opened.


Here are some commonly used options with the open command:

  • -a <application>: Specify the application to open the file with. If not specified, the default application associated with the file type is used.
  • -e: Opens the file with the default text editor.
  • -t: Opens the file with the default text editor, same as -e.
  • -f: Reads input from standard input and opens it with the default text editor.

Typical usage:

  • The -a option can be used when the user wants to open a file with a specific application rather than the default one.
  • The -e and -t options are helpful for quickly editing text files from the command line.


Open a PDF file with the default viewer:

open example.pdf

Open a website in the default browser:


Open a file with a specific application:

open -a 'Google Chrome' example.html

Open text from a pipe in the default text editor:

echo "Hello, world!" | open -f

Common Issues

Problem: Attempting to open a file with an application that is not installed or incorrectly specified.

Solution: Verify the application name and installation. Use proper application names as they appear in the OS/application listings.

Problem: Opening unsupported file formats.

Solution: Make sure that the file format is supported by the application. Convert the file to a suitable format if necessary.


The open command can be integrated with other Linux commands for more complex tasks. For instance, searching for specific files and opening them:

find . -name "sample*.txt" -exec open {} \;

This command finds all txt files starting with sample in the current directory and opens them.

  • xdg-open: A more universal command in Linux that serves a similar purpose, opening files or URLs in the user’s preferred application configured via the XDG MIME Applications settings.
  • see: Another alternative to open, specifically on Ubuntu and similar distros.

For further reading and more detailed information, refer to man xdg-open or the specific man page of the application you intend to use with open.