14

enter image description here

I have added a path in bashrc, still, the command is not found. When tried in ubuntu it worked but not in WSL. Why this happen?.

export PATH=\wsl$\Ubuntu\usr\local\mbdyn\bin:$PATH

added same path in .bashrc

error: command not found

**Please see the attached image

1
  • 2
    Welcome to Stack Overflow. Please note that questions here should be about "specific coding, algorithm, or language problems." Please consider posting questions like this on Unix & Linux Stack or Super User in the future. Short answer, though, your path is incorrect in at least two ways - Linux paths use /, not `. And you should start from /usr/` since that's the Linux path. Commented Feb 21, 2021 at 23:09

2 Answers 2

28

As you have been told, the forward slash to use is / and if you use the command

PATH="$PATH:/folder/subfolder/" 

that value will only last in the PATH for the duration of the session. To include a value in the PATH permanently, edit the .bashrc file from your home

$ sudo vim ~/.bashrc

you add at the end

export PATH="$PATH:/folder/subfolder/"

you save and you will have that value in the PATH in each session

Sign up to request clarification or add additional context in comments.

3 Comments

This should be the answer given its extra details which enforces the path each time we load linux
It didn't work for me. There was no .bashrc file so I had to create it, after which I followed similar instructions. Here's the version I'm using $ bash --version GNU bash, version 4.4.12(0)-release (i686-pc-cygwin)
Suppose I want to add multiple folders to the path, what's the syntax for that?
1

You will need to modify the PATH variable as follows:

PATH="$PATH:/usr/local/mbdyn/bin"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.