Home » Questions » Computers [ Ask a new question ]

Linux equivalent command for "open" command on Mac/Windows?

Linux equivalent command for "open" command on Mac/Windows?

Coming from Mac OS X, you can type:

Asked by: Guest | Views: 263
Total answers/comments: 2
Guest [Entry]

"xdg-open is what you're looking for.
You might like this snippet I put in my .bashrc files so that whether I'm using cygwin on Windows, Linux, or OSX, I can use either the start or the open commands and they work great:
case ""$OSTYPE"" in
cygwin*)
alias open=""cmd /c start""
;;
linux*)
alias start=""xdg-open""
alias open=""xdg-open""
;;
darwin*)
alias start=""open""
;;
esac

Good comments, xdg-open is indeed a better option than gnome-open as explained below. I updated my personal scripts a while ago, but forgot to update this answer.
WARNING: This will override the functionality of both openvt (virtual terminal) and start from init."
Guest [Entry]

"You can even write a small wrapper around gnome-open to open multiple files with one command:

for i in $*
do
gnome-open ""$i""
done

Put this into a shell script named open and

open *.c

will open all c files in the current directory."