How to open a specific application like macOS `open -a`?
You can specifically use your desired program's name (if it's able to be used as a command line tool).
For example, urls:
firefox duckduckgo.com
chromium-browser askubuntu.com
PDF:
evince foo.pdf
okular bar.pdf
Images:
gpicview foo.png
feh bar.jpeg
Texts:
gedit foo.txt
mousepad /etc/config
leafpad bar.xml
Video/Music:
mpv foo.mp3
vlc bar.mp4
If you want the program to be run detached from the terminal then this is the way that I prefer doing it:
nohup program args &
For example:
nohup firefox askubuntu.com &
Remember that you can always redirect the outputs as usual, e.g. :
nohup firefox duckduckgo.com &> /dev/null &
As indicated in a response to the accepted anwser, the equivalent to the open
command from macOS in Linux is xdg-open:
xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.
When compared to the macOS open
, the main difference is that here you can't specify an specific application to use from the command line. For that, you can refer to the accepted answer, as the problem is kind of pointless in Linux because applications are normally available in your PATH already.