Alias to open a file with a specific program

How do do it

Note

If you follow this guide from the beginning you added Your Web Browser to the environment variables.

This is what we will use as an example but you can do it with other programs.

Warning

Minimize the number of programs you add to your environment variables.

Tip

Only add your very commomly used programs to your environment variables like your text editor and your web browser.

Create an alias to open a file with a specific program

  • Edit your .profile file
  • Type
alias <YourAliasName>="<YourProgram>"

Note

Give the name of your program launcher, most of the time a YourProgram.exe file, without the extension

For Firefox for example

alias fx="Firefox"

Note

To open a web page from your terminal

Note

By following this example you can now launch google home page from your terminal by typing

fx www.google.com