1

Have a look at this screenshot:

Terminal Commands

$ mkdir someDir
$ cd someDir
$ ls -l
total 0
$ touch someFile
$ ls -l
total 8
-rw-rw-r-- 1 user user 0 Nov 5 01:29 someFile

Pardon for my language used when I installed Ubuntu. Anyways, it is beyond my imagination how come creating an empty file actually creates eight files, alas, the extra seven won't be listed more than have their saying in the statistics. The total column clearly says eight. I'm using Ubuntu 12.10 x86. Also, in my Nautilus file explorer, I have checked the option to view hidden and system files. Maneuvering to the new someDir directory won't show more than just one file, the someFile file. So is the total count lying in my face or are there even more hidden files than the "ordinary" hidden files? I'm keen to know exactly what files gets created here, why so, and how come I can't list them.

As a side note, adding the sudo prefix to the ls -l command won't make any difference for me.

Thank you so much in advance.

0

1 Answer 1

3

From ls Man Page for OSX (i expect its the same on linux, but i dont have 1 handy to test atm)

-l (The lowercase letter ``ell''.) List in long format. (See below.) If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing.

So the number is the sum of file size, and not a count of number of files.

2
  • oh well that makes sense =) My man command won't print that info. All he says is "use a long listing format". But I get more info if I type the command info coreutils 'ls invocation', this page says that the count is "'total BLOCKS', where BLOCKS is the total disk allocation for all files in that directory." Nov 5, 2012 at 12:21
  • Please note that while in this case behavior is similar, assuming blindly that utilities of same name behave the same on all Unix-like systems is not correct. OS X uses BSD utilities, while most Linux distributions use GNU coreutils package. A good example of incompatibility can be seen in the find utility. GNU one assumes current working directory if you don't specify a directory as parameter, while BSD one requires explicit declaration. BSD df for example doesn't have some of the flags that GNU df has Mar 29, 2017 at 7:18

Not the answer you're looking for? Browse other questions tagged .