open .
Open a CSV in default spreadsheet program: open example.csv
Open the same CSV in TextEdit instead: open -a TextEdit example.csv1–10 of 11 posts
open .
Open a CSV in default spreadsheet program: open example.csv
Open the same CSV in TextEdit instead: open -a TextEdit example.csvI regularly use it to open a Finder window with the current directory
On Linux there is a similar tool called `xdg-open` for graphical desktop environment users
open -e example.csv
And -t opens with the default text editor.Other useful options include -j to launch the app hidden, -R to reveal the file in the Finder, -W to stop execution until the app exits (useful for scripts), and -n to launch a new instance of the app (new icon will show up in the Dock). You can connect multiple flags for more complex effects.
For example, I have a script which opens iA Writer and waits until I close it before continuing. If I already have it open and editing other stuff, -W will wait for that instance of the app to close, which is a bother. So instead I do:
open -Wna 'iA Writer' example.txt
Which opens a new instance of the app and waits until that one is closed, thus avoiding interfering with previous work.Highly recommend taking a look at man open. It isn’t long but it is quite useful.
Yep, `open` is great I regularly use it to open a Finder window with the current directory On Linux there is a similar tool called `xdg-open` for graphical desktop environment users
Alternatively, you can drag a file into the terminal and it will paste the file path there, which is really cool.
- Open current directory in Explorer:
explorer .
- Open a file (prompts which program to open it with): explorer README.md