The cd command in CentOS 7

I have been working in a CLI environment for many years, so the cd “change directory” command is nothing new to me; however, an accidental typo presented an unexpected result.  Instead of typing “cd ..” which would transverse back one directory, a user typed only “cd” with the intention of pasting from the clipboard the rest of the path.  The clipboard was empty, so the “cd” command transversed to another directory which wasn’t the expected result.

After a few tests, the set of tests below produces the same results and a single conclusion.  The cd command used alone or with ~ or with ~/ will in each case transverse to the home directory of the active user.

[admin@centos7server ~]$ whoami
admin
[admin@centos7server ~]$ pwd
/home/admin
[admin@centos7server ~]$ cd /opt/test
[admin@centos7server test]$ pwd
/opt/test
[admin@centos7server test]$ cd
[admin@centos7server ~]$ pwd
/home/admin
[admin@centos7server ~]$ cd /opt/test
[admin@centos7server test]$ pwd
/opt/test
[admin@centos7server test]$ cd ~
[admin@centos7server ~]$ pwd
/home/admin
[admin@centos7server ~]$ cd /opt/test
[admin@centos7server test]$ pwd
/opt/test
[admin@centos7server test]$ cd ~/
[admin@centos7server ~]$ pwd
/home/admin

This conclusion is confirmed from the man pages with man cd.  Here is a truncated relevant reference.

cd [dir]
Change the current directory to dir.  The variable HOME is the default dir. 

Be careful as to which command you elect to type to follow…

.