-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

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
  • 43,546
  • 8
  • 97
  • 150
waltinator
  • 36,399