Specific characters in command line

2019-09-19 11:29发布

问题:

I am working in cmd and I found a symbol that I am not sure for what reason is used. Why do we use "~/" in command line. Specifically in that case:

cp -R modules/swagger-codegen/src/main/resources/htmlDocs2 ~/templates

Thank you!

回答1:

~/ is short term for your home directory

~username/ is short term to username's home directory



回答2:

Many times while coding you need to pass the whole path of the file in cmd.

So it is just a shortcut to let the command line know that file is in the home directory itself.



标签: shell