I think I messed up the PATH. I was installing Bioperl and tried to changed path. The correct code should be:

$ export PATH=/usr/local/ActivePerl-5.26/bin:$PATH
$ export PATH=/usr/local/ActivePerl-5.26/site/bin:$PATH
export PATH

-- But I did something stupid and what I typed is attached. Although Bioperl is installed, the ls or mkdir command are not working any more.enter image description here

  • logout and login again. All those export commands will be forgotten – Stephen Harris Jan 11 at 1:10
  • :export PATH is wrong, as the colon attaches export to the PATH variable. you probably want a semi-colon ; instead there – thrig Jan 11 at 3:23
  • Hi rongrong, I wondered whether you would consider accepting my answer? If you think it could use improvements, please give me feedback :) – cryptarch Jan 16 at 18:27

The first time you ran export PATH=/usr/local/ActivePerl-5.26/ it replaced your entire previous path with that one single directory.

Subsequent attempts to "do the right thing" were now using the new path, so when you ran PATH=/usr/local/ActivePerl-5.26/bin:$PATH, what that did was update the PATH variable to contain the following string:


To recover from this situation, you have a few options:

1. Explicitly set the path to be what you want

Run something like the following (edit according to your requirements:

export PATH=/usr/local/ActivePerl-5.26/bin:/usr/local/bin:/usr/bin:/bin

2. Source your bashrc or bash_profile to reset the environment

You probably have your default path set in either ~/.bashrc or ~/.bash_profile. Let's assume it's in ~/.bashrc, then you can reset it like so:

. ~/.bashrc

Which is short for:

source $HOME/.bashrc

3. Start a new shell session

It might be simplest to just abandon the current session and start over. Close the terminal and open a new one; or go into a new shell inside the current terminal by running /bin/bash

  • 1
    I tried the #3 way, but it turned out I dont have .bashrc folder, lol. #2 way works for me! Thank you so much. – rongrong Jan 16 at 23:30

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.