问题原文
原帖链接 · DR01D · CC BY-SA 3.0
I'm using Ubuntu 16.04.
Step 1) I logged into my root user account.
Step 2) I used cd to navigate to a different user account's home directory.
Step 3) I typed ls to examine the contents of that directory.
Step 4) The contents came back as empty.
Step 5) I typed mkdir .ssh to create a directory.
Result) mkdir: cannot create directory '.ssh': File exists
Question: Why is the directory listed as empty if an .ssh folder exists inside of it?
-- update --
I logged into root because this is a test server. I'm repeatedly creating and destroying it.
已采纳解答
原帖链接 · Patrick · CC BY-SA 3.0
ls by itself does not show hidden directories (hidden directories and files are ones that start with a ., such as .ssh)
Try using ls -a in the directory.
From the ls manpage:
-a, --all
do not ignore entries starting with .
As noted in the comments, "hidden" directories and files are not technically a thing, there is just code built into a lot of common tools that treat . and .. with special meaning, the result being that . is usually considered "hidden" by most tools. The reason I used this term is because it's common to hear it referred to that way.
Additionally . and .. usually have special meaning to most filesystems, indicating current directory and parent directory, respectively.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
