-2

In 20.04 I used .bashrc to include a hidden folder in my system path: /home/robert/.local/...

Since upgrading to 22.04, it appears that the system no longer searches this folder. Has this changed in 22.04? Can I restore it? enter image description here

2
  • thanks, but no thanks, Artur! I have the .local folder, and it contains the files I need. It is simply that the path does not 'reach' it.
    – Pansmanser
    Commented Jun 13, 2022 at 11:14
  • Are you sure that the directory in question is actually in your path? It's hard to tell, you only gave a fragment, not the actual value of $PATH. Also, is the .local directory early in the path or is perhaps another directory with similar filenames first?
    – user10489
    Commented Jun 13, 2022 at 11:31

3 Answers 3

3

This has not changed in 22.04. As in Ubuntu 20.04, executable will be searched in any directory that you include in the PATH environmental variable.

If you have some problem - which you did not actually explain - then rest assured that the cause will not be what you currently asked. Also hidden paths can be included and will work. For example, also Ubuntu 22.04 automatically will include ~/.bin and/or ~/.local/bin in the PATH if these exist.

2
  • Rest assured, Vanadium, that neither of the paths you mention are in my default path. Don't assume that because you do not observe a problem it does not exist. I have edited the original question to include my current path. Of the ones I have added. /home/robert/sbin works, but /home/robert/.local/share/applications does not.
    – Pansmanser
    Commented Jun 14, 2022 at 9:47
  • Not I did not say these paths exist for you. I just indicated them as examples of hidden paths that are eventually used by default. My point is, your issue, whatever (you still are not clear) is not because hidden folders in a PATH do not work. Your system searches that folder for executables.
    – vanadium
    Commented Jun 15, 2022 at 10:25
1

As per the image added to your question, I assume the "hidden" directory in question is /home/robert/.local/share/applications. As this is at the end of your path, if anything in that directory also exists in other directories (like /usr/bin or even /usr/robert/bin), then the .local directory will be shadowed for those and the ones earlier in the path will be preferentially run.

If, for instance, you are trying to run an executable named thing, you can use either of these commands:

type -a thing
which -a thing

and you may find it lists both executables, although only the first one in the path would be run.

1
  • Thanks, @user10489. I think that has cracked it. I had an obsolete version of the script I wanted further up the chain. I had not realised that I was running that one.
    – Pansmanser
    Commented Jun 15, 2022 at 21:11
0

I'm assuming that you got a clear ~/home directory with the upgrade, hence you asking about the Ubuntu versions. And I honestly don't know what the version has because I maintain my own ~/home.

Can you simply add:

export PATH=~/.local/bin:$PATH

at the end of your .bashrc? (Replace bin with whatever folder you want, and include multiple folders separated by colons.)

One last thought: if you did keep your .bashrc, perhaps you were relying on defaults in `/etc' and that file got moved or changed somehow. That would explain the change.

1
  • Thanks ATony. Yes, I used the method you suggest to add to the PATH. The addition works, but the folder does not seem to be searched when seeking for commands.
    – Pansmanser
    Commented Jun 15, 2022 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .