ENV PATH Variable update Link to heading
I have recently installed SNAPD and HUGO. But i am unable to run this “hugo version” as the installed folder does not fall under the default /bin or /usr/bin. Refer the error
$ hugo version 127 ⨯
Command 'hugo' is available in '/snap/bin/hugo'
The command could not be located because '/snap/bin' is not included in the PATH environment variable.
hugo: command not found
Default ENV variables
env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/home/rocky/.local/bin
You can see /snap/bin does not fall under this. To add this at the end of existing use this command
export PATH=$PATH:/some/new/path
To add the new path prepending the existing values Use this
export PATH=/some/new/path:$PATH
To keep Only new path Use this command( remember if any programs under /bin or /usr/bin will not work without mentioning the full path after this)
export PATH=/some/new/path
In this case I am adding new path to the end of existing PATH variables.
export PATH=$PATH:/snap/bin
┌──(rocky㉿kali)-[~/mysite/exsite]
└─$ env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/home/rocky/.local/bin:/snap/bin
Now the Hugo command works as well( no need to manually type /snap/bin/hugo)
hugo version
hugo v0.93.3+extended linux/amd64 BuildDate=2022-03-08T16:34:16Z
However this is not permanant and valid for only existing session. Refer my output after reboot
Command 'hugo' is available in '/snap/bin/hugo'
The command could not be located because '/snap/bin' is not included in the PATH environment variable.
hugo: command not found
Repeat the export command once again. The edit the /etc/enviornment

Now the new path has been added permanatly. To test you can open a new sesison or after reboot issue this command test
env | grep PATH
$ env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/snap/bin: