This question already has an answer here:
Often in the terminal I want to open a specific file (since I've already browsed to the right directory).
A few programs I have come with their own links ready, like
subl index.html will open Sublime Text editor. Also I am aware of the
open foo which will call the file to be opened in the default program associated with it.
How can I setup a more general way of opening a file from the terminal with a specific program, either by defining a per-program helper/shortcut, or better even, in a generic way?