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?

Ghazali
  • 1
  • 3
  • 4
    Does this answer your question? [How can I reset $PATH to its default value in Ubuntu?](https://askubuntu.com/q/113419/) and [How to add a directory to the PATH?](https://askubuntu.com/questions/60218/how-to-add-a-directory-to-the-path) – karel Jan 22 '21 at 06:26
  • @karel yep thanks for the help. – Ghazali Jan 23 '21 at 07:03
  • If this link answered your question you can confirm it by clicking the link in the blue banner above your question's body text block. – karel Jan 23 '21 at 07:04

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