0

Today I accidentally typed ls ~bin
I wanted to type ~bak - that's my junk backup folder, but ~b<tab> deceived me.

Instead I got this:

$ ls ~bin
core_perl                             fogcoord                     lftp                           pcmanfm                                 snmpvacm
site_perl                             fold                         lftpget                        

... many miles of output ...

Could anyone kindly explain what the hell happened here? Works also with cd, for example.

There is no such folder (or symlink) in pwd - it's the real /bin. I also tried ls ~etc, but that didn't work.

Here's my ls:

$ alias ls
alias ls='ls --color=auto --group-directories-first -h'
MightyPork
  • 1,222

1 Answers1

3

There is a bin user with home /bin:

$ getent passwd bin
bin:x:1:1:bin:/bin:/bin/false

Now ~bin refers to the home directory of the bin user which is /bin and contains all the many miles of commands.

The same way ~etc does not work, because there is no etc user.

michas
  • 21,510