I knew how to set up a command in $PATH, but I need someone refresh my mind. In fact, I have the '.sh' script /home/jeremie/Downloads/pycharm-community-2016.3.2/bin/pycharm.sh that I want to put in $PATH. My purpose is to be able to use pycharm as a command. I figure out that the first step is export PATH = $PATH:Downloads/pycharm-community-2016.3.2/bin/pycharm.sh, but It is unclear.

How to convert /home/jeremie/Downloads/pycharm-community-2016.3.2/bin/pycharm.sh to obtain the pycharm command?


The PATH is a list of colon (:) separated directories where the shell will search to find the file you're calling. Therefore you would need to add /home/jeremie/Downloads/pycharm-community-2016.3.2/bin to it and not include the file itself.

If you want to change the name from pycharm.sh to pycharm, you would either rename or copy it, or preferably make a symbolic link to it such as:

ln -s /home/jeremie/Downloads/pycharm-community-2016.3.2/bin/pycharm.sh /home/jeremie/Downloads/pycharm-community-2016.3.2/bin/pycharm

Note that your expression export PATH = $PATH:Downloads/pycharm-community-2016.3.2/bin/pycharm.sh will fail because of extra spaces surrounding the equal sign (=). Properly corrected, it should be:

export PATH=$PATH:/home/jeremie/Downloads/pycharm-community-2016.3.2/bin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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