How to open a file from the command line using default application

The most common way to do this is to use xdg-open, simply install xdg-utils
$ apt install xdg-utils
and you good to go. To open a file , say foo, run:
$ xdg-open foo
to send an email run:
$ xdg-email someone@important.com
To lock a screen run:
$ xdg-screensaver lock
More info can be found in:
 
Disclaimer Privacy