This is fairly trivial and I'm just curious as to why mkdir ~root/.ssh is the same thing as mkdir/root/.ssh?  I'm reviewing the following docker file and the creator usesmkdir ~root/.sshto create the.ssh` directory:https://github.com/macropin/docker-sshd/blob/master/DockerfileIs there any advantage to one over the other? When I first read it I assumed that ~root would expand to /rootroot.
Why is `mkdir ~root/.ssh` the same thing as `mkdir /root/.ssh`?
mkdir;tilde
~USER is just a shorthand notation for the home directory of user USER. For a normal user, this would typically be /home/USER, but for root, it is typically /root. As for your question whether one is preferable to the other: The only difference is that ~root gets expanded dynamically to root's home directory, whereas /root is an absolute path that does not undergo any expansion process. What you want depends on your particular use case. If you want your script to work on machines where root's home directory lies elsewhere than in /root, then use ~root. If you want to make sure that the absolute path /root is always used, use /root.In practice, it should not make any difference in most cases, though I would personally feel safer using /root unless I have reason to expect that my script will be run on machines where root's home directory is not /root.