-2

i accidentally change my path to this

$ echo $PATH
/home/josh/snap/flutter/common/flutter/bin:/snap/bin:/snap/bin:/snap/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

how can i change that $PATH into this permanently? like this

$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

i tried every solution but when i close the terminal and open it again, the path still not change

  • 3
    Does this answer your question? [How to add a directory to the PATH?](https://askubuntu.com/questions/60218/how-to-add-a-directory-to-the-path) – pLumo Apr 05 '22 at 06:05
  • What are you trying to achieve in the first place ([See also](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem))? Seems you want to get rid of `snap`, but there are better ways than changing PATH. – pLumo Apr 05 '22 at 06:07

1 Answers1

1

PATH is a colon-sepatated list of directories that your shell searches, looking for commands to execute.

Set your PATH in your ~/.bashrc by adding the following line to the end of your ~/.bashrc file:

export PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

After you save the changes to the file, run the following command in each open shell to apply the changes or simply log out and log back in:

source ~/.bashrc
mchid
  • 42,315
  • 7
  • 94
  • 147
waltinator
  • 35,099
  • 19
  • 57
  • 93