I want to open videos and pictures from Terminal. Is there any way to do this?

  • What is this? questions should be stand alone and not depend on other sites
    – mmmmmm
    Oct 24, 2015 at 21:48
  • this question is dependent on stackexchange website. If thats not allowed I can recopy complete stuff from that site to this site. Oct 24, 2015 at 21:59
  • 1
    I edited the question so it stands on its own. It didn't require external information.
    – Tuesday
    Oct 24, 2015 at 22:01
  • Please and explain what you want to do in user terms not just the ebonite command - and note the edit to improve the text has lost the link so you need to edit
    – mmmmmm
    Oct 24, 2015 at 22:02
  • You should be more specific in your question about the platform/OS your are using as WSL, Linux, and Mac have different tools/commands to perform this task.
    – Agent 0
    Sep 16, 2021 at 5:16

3 Answers 3


To open any file from the command line with the default application, just type open followed by the filename/path.


open ~/Desktop/filename.mp4

Edit: as per Johnny Drama's comment below, if you want to be able to open files in a certain application, put -a followed by the application's name in quotes between open and the file.


open -a "QuickTime Player" ~/Desktop/filename.mp4

If you need further information about the open command, type man open.

  • 11
    Just to complete this answer: With timotyhm's command you will open the file with the default application for this filetype. If you want to open any file with a specific application, just enter: open -a "Application" /Path/to/file. Example: open -a "Adobe Photoshop CC 2014" ~/Desktop/test.psd. See man open for more information.
    – joni
    Oct 25, 2015 at 8:05
  • 1
    @JohnnyDrama Good point. Can I edit that into my answer?
    – Tuesday
    Oct 25, 2015 at 15:39
  • 3
    The collaboration in answers is awesome. Johnny Drama's answer is what I really wanted, but the title is what I searched. Answers like these are why I love StackExchange!
    – mbm29414
    Sep 30, 2016 at 13:16
  • 2
    This does not work. 18.04. jpg.
    – mathtick
    Dec 2, 2018 at 14:50
  • To complete the answer even more, if you have multiple apps with the same name (e.g. you're developing and have an app store version and a debug version), you can specify a path to the app. Example: open -a /path/to/MyApp.app /path/to/file.txt
    – Patrick
    Mar 21, 2022 at 4:08

It can also be done by using xdg-open filename. Command will open the file with it's default application and it also used to open the urls .

  • xdc-open is not a stock Mac OS X tool.
    – lhf
    Jan 2, 2018 at 17:49
  • 2
    xdg-open is on Linux and macOS is not Linux! The accepted answer has the default macOS command line app, open. Jan 2, 2018 at 17:58
  • Awkwardly this question is the top google hit for "linux open any file". So while this is not a correct answer for the question asked, it is really handy to have this listed highly. I can't bring myself to vote this answer up, but I will vote the other wrong answers down to ensure this stays prominent.
    – LovesTha
    Oct 7, 2020 at 22:21

"open ." to open current directory.

  • 3
    Hi, while this does work (it opens the current folder in the Finder), this does not seem to answer the question (which is to open videos and pictures from the terminal, not the folder they reside in). Can you add any more detail to your answer which will help answer the question?
    – Oion Akif
    Jul 5, 2018 at 4:15
  • @Developer Madmax Thanks for sharing the method. Sometime this command line not opened the Files application. What condition could be?
    – Cloud Cho
    Aug 26, 2022 at 21:18
  • There is no Files Application on MacOS.
    – mmmmmm
    Aug 26, 2022 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .