This question already has an answer here:

I have the following go program that runs with:


How can I create a symlink to run this program with the command weather?

marked as duplicate by heemayl, Thomas Ward, s3lph, Mitch May 15 '15 at 17:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @heemayl he wants a bash alias. – Tim May 15 '15 at 15:52
  • 1
    askubuntu.com/questions/17536/… – Tim May 15 '15 at 15:53
  • 1
    @Tim he can achieve the same with a symlink, and won't need a bash alias to execute (you can create symlinks with different names on the link, and it'll execute the actual thing it's linked to) – Thomas Ward May 15 '15 at 15:55
  • @Tim probably..i might have fallen for the literal wording :) – heemayl May 15 '15 at 15:55
sudo ln -s /whole/path/to/script.extension /bin/weather

This will create a symlink into the /bin/ folder, which is included in everyone's PATH. If it requires sudo to run, I recommend placing it in /sbin instead of /bin.

  • 3
    It's more of a cosmetic difference, but traditionally scripts that require elevated or superuser access go in sbin so they can be differentiated from scripts that do not require superuser access (those in bin). – Andrew Meyer May 15 '15 at 16:19
  • I really have the same problem as before, maybe I need to be more clear. Is there a way I can type "weather" and omit "./" in "./weather" to run the program? This is the type of functionality I am looking for – JZ. May 15 '15 at 20:29
  • If you symlink it Into /bin and log out then back in it should work without the ./. Once it is included in a directory in your PATH you won't need to specify the location – Andrew Meyer May 16 '15 at 1:59
  • As an added note, you should probably use /usr/local/bin since it is a more canonical directory for user scripts – Andrew Meyer Oct 20 '17 at 16:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.