92

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 '15 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. – CodingOnSteroid Oct 24 '15 at 21:59
  • 1
    I edited the question so it stands on its own. It didn't require external information. – Timothy Mueller-Harder Oct 24 '15 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 '15 at 22:02
128

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

Example:

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.

Example:

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

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

| improve this answer | |
  • 10
    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 '15 at 8:05
  • @JohnnyDrama Good point. Can I edit that into my answer? – Timothy Mueller-Harder Oct 25 '15 at 15:39
  • 2
    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 '16 at 13:16
  • 1
    This does not work. 18.04. jpg. – mathtick Dec 2 '18 at 14:50
-1

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 .

| improve this answer | |
  • xdc-open is not a stock Mac OS X tool. – lhf Jan 2 '18 at 17:49
  • xdg-open is on Linux and macOS is not Linux! The accepted answer has the default macOS command line app, open. – user3439894 Jan 2 '18 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 at 22:21
-1

"open ." to open current directory.

| improve this answer | |
  • 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? – Skeleton Bow Jul 5 '18 at 4:15

You must log in to answer this question.

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