If I enter
$ echo $HOME
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Why do I get this output? Why are /usr/local/bin
and such in $HOME
?
The reason you get that output is because that is the content of the $HOME
variable. I think the better question to ask is "why is that the value of my $HOME
variable?"
Typically the system will automatically set the $HOME
variable based on the contents of /etc/passwd
(or sshd
in the case of an ssh
connection, see this post). It is possible that you overwrote the value somewhere else, maybe in the .bashrc
(or whichever rc
file your shell uses). Those contents would seem appropriate for the $PATH
variable but not for $HOME
so I would start by checking your .bashrc
(or again, whatever rc
file is appropriate) and see if there is a line like export $HOME=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
in there.