0

I am new to linux and I was trying to set up path of JAVA_HOME but I accidentally wrote export PATH=/usr/lib/jvm/java-11-openjdk-amd64 which I think overwrote $PATH.

I am quite sure I have messed up big time. Because when I enter $PATH, it says zsh: no such file or directory: /home/gshacklebolt/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Is there any way to revert what I did?

1 Answers1

1

If you want to check the PATH you need to type

echo $PATH

I think the original path should be restored after a reboot. And then to add a new dir to the path

export PATH=$PATH:/add_tour_path_here

Hope this helps you out.

  • I have rebooted the system and on entering $PATH this is what i get zsh: no such file or directory: /home/gshacklebolt/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games – Ghazali Jan 20 '21 at 10:35
  • Typing $PATH means that you want to run the contents of your PATH variable as a command - which would definitely not work, hence the error message. But this message quotes the command you tried to run, which is /home/gshacklebolt/.local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games - so that is your PATH. As written in the answer, if you want to display your PATH, type echo $PATH, not just $PATH. – raj Jan 20 '21 at 11:27