This is not a programming question.
I have a machine running Ubuntu, and I installed Golang on it. It was working fine... I even ran a few programs, but the "go1.11.2.linux-amd64.tar.gz" file was in my home directory so I thought it would be okay to move it to the Downloads directory. After moving it, I can't use any Go command, and I get command 'go' not found. I tried moving the file back to the home directory, but I'm still getting the same error.
Can anybody explain to me what's going on? Thanks!!
richie@richie-ThinkPad-T430:~$ go version
Command 'go' not found, but can be installed with:
sudo snap install go # version 1.11.2, or
sudo apt install golang-go
sudo apt install gccgo-go
See 'snap info go' for additional versions.
The commands I used to install Go :
wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
source ~/.profile
tar,gz
file isn't relevant. Did you install from source? Please [edit] your question and show us the commands you used to installgo
. – terdon Nov 13 '18 at 15:27export
command into the.profile
. Please manually execute the correctexport
command and try again. – Jos Nov 13 '18 at 15:34tar,gz
file has nothing to do with it. I ranexport PATH=$PATH:/usr/local/go/bin
and thengo version
and I get the right version – richie Nov 13 '18 at 15:41export PATH=$PATH:/usr/local/go/bin
command every time I need to build a project...can you show me how I'm supposed to put theexport
command into the.profile
– richie Nov 13 '18 at 15:43nano
. Otherwise, start upgedit
or installgeany
. – Jos Nov 13 '18 at 15:54export PATH="/home/richie/go/src/hello:$PATH"
to the bottom of thegedit ~./profile file
but it still isn`t working – richie Nov 13 '18 at 16:12go
command has now been found. – Jos Nov 13 '18 at 17:04cd
to make sure you're in the home directory.nano .profile
to open the .profile file. add the export line at the end of the file. And that's it. You'll need to either restart your terminal or maybe reboot for the changes to take effect. Also, go through a command line basics tutorial before you jump deeper. "The Linux Commandline" by William Shotts is pretty good. – kchak Jan 16 '21 at 11:13