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– mmmmmmOct 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.– abhimanyuaryanOct 24, 2015 at 21:59
-
1I edited the question so it stands on its own. It didn't require external information.– TuesdayOct 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– mmmmmmOct 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 0Sep 16, 2021 at 5:16
3 Answers
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
.
-
11Just 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
. Seeman open
for more information.– joniOct 25, 2015 at 8:05 -
1
-
3The 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!– mbm29414Sep 30, 2016 at 13:16
-
2
-
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
– PatrickMar 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 .
-
-
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.– LovesThaOct 7, 2020 at 22:21
"open ." to open current directory.
-
3Hi, 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? 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? Aug 26, 2022 at 21:18
-