This question already has an answer here:

How to view files, created by Linux and programs in /tmp directory? The file names are hidden, command ls -al /tmp only show the presence of files not their names.

Edit: I find that place in saved session logs:

# ls -al /tmp
drwxrwxrwt    2 0        0              40 Jan  1 00:00 .
drwxr-xr-x   19 1005     1005          219 Aug  2  2017 ..
# grep -r config /tmp
# grep -r bin /tmp
# umount /mnt
# ls -l
drwxrwxrwt    2 0        0              40 Jan  1 00:00 tmp

Third line show that /tmp directory have 19 files(?), but I don't see it. Or I have missed something?

marked as duplicate by Kusalananda linux Jul 21 '18 at 16:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    "only show the presence of files not their names" - it's unclear what you mean with this, and totally contradicts the expected output of ls -al. Please add the complete output of that command to your question, best including the command itself; use copy&paste and format it as code for better readability. – Murphy Dec 27 '17 at 12:14
  • @Murphy I have added details. – minto Dec 27 '17 at 21:26
  • The third line is .., the parent directory. So what else can you expect? – Weijun Zhou Dec 27 '17 at 21:55
  • No; the third line means that this entry has 19 hard links, which in this case means that the root directory has 19 subdirs; that seems OK. However there are some strange things in this listing: UID/GID 0 is root, allright, but / belonging to user 1005, which in most cases is a manually created user, is rather unusual; it should belong to root, too. Additionally the UIDs aren't resolved to user names, what I would have expected. – Murphy Dec 27 '17 at 22:10
  • ... In short, your /tmp dir seems fine, but empty, but I can't say anything about the rest of the system; it may be a normal state for your system or not. – Murphy Dec 27 '17 at 22:19

The number in the second column of an entry in the output of ls -la is the number of hard links pointing to the same inode; in the case of a directory entry this means the number of subdirectories including the special . dir mentioned below; you can read more details e. g. in this answer.

The entry .. represents the parent directory, which in this case is the root directory /. 19 or 20 subdirectories of / is quite normal, as far as I can tell, but depends on the distribution and local additions.

The entry . represents the current directory, in this case /tmp - it contains only . and .., as shown in the listing, thus 2 hard links: one for its sole existence in /, one for . pointing to it.

Your conclusion that /tmp has "hidden" entries is wrong; the temp dir is definitely empty right now.

There are some oddities which I mentioned in my comments, but these are out of scope for this question. If you're experiencing any problems you should open new questions for them, with a detailed description what you see (don't forget to show output for evidence), what you expect and why you think it's wrong or unusual.

  • 1
    Linkcount 2 for dot tells you /tmp contains no (sub)directories, but it doesn't say anything about containing files (or fifos sockets devices etc). And 19 for .. tells you root contains 19-2=17 subdirs. – dave_thompson_085 Dec 28 '17 at 2:36
  • @dave_thompson_085 Thank you for the hints; I've fixed the text. – Murphy Dec 28 '17 at 3:40

I use ls -lah /tmp to see all 1st level files and directory in /tmp.

'l' for list
'a' for all
'h' for human readable file size

As tmp directory comes with 777 permission by default any user can read, write and index through the directory and root access is not mandatory to list it's contents.

In Linux hidden files and folders start with a . at beginning. So, form the output you can recognise a file or folder as hidden by a . at beginning.

If the above command isn't returning any content details probably /tmp in your system is currently empty.

Also if you're in a busybox Android shell the /tmp directory may be absent. /tmp directory itself is not mandatory for Android implementation.

Not the answer you're looking for? Browse other questions tagged or ask your own question.