0
votes

when checking my $PATH on ubuntu (16.04) I get a long list of directories, few of which even do not exist in my file system, and some of them I just don't need:

echo $PATH

.../usr/games:/usr/local/games:/snap/bin

where they are created and how can I remove them? I wnant to control the creation of the $PATH, rather than correct it later by the tricks described in https://unix.stackexchange.com/questions/108873/removing-a-directory-from-path

3

3 Answers

1
votes

Some typical places where $PATH can be set when starting up a bash shell on Ubuntu include:

  • /etc/profile
  • ~/.profile
  • ~/.bashrc

where ~ represents your home directory.

Also look at any scripts called by those scripts.

There may be other things that get called when starting up a bash shell, depending on various conditions. For details, take a look at the INVOCATION section from the command:

    $ man bash
0
votes

See this answer from askubuntu.com to edit the path either using a text editor or the command line.

0
votes

I found the answer to your question today. The path you want to edit is in /etc/environment.