console ls command displaying incorrect information

Hi,

When I type “ls -l” into the console it gives me a listing of the files in my directory.
For each file in the list, the first ten fields are permissions (-xwr-wr-wr).
Then directly following these file permissions is supposed to be the number of hard links the file has. And if this file is a directory, then the number of folders inside it, aswell as the number of hard links it has.

In my Konsole, all I get is a 1 for every file/folder in the list.

I’m running opensuse 12.1 (kernel 3.1.10-1.9-desktop).

Heres a link to a screenshot:
http://www.splashportal.net/images/ls-error.png

What makes you say that ls is supposed to list the number of folders inside a folder? I can’t find any mention of it in neither POSIX.1-2008, Linux Standard Base nor in GNU Coreutils. I might have overlooked something though.

On 2012-04-30 19:46, Quantumboredom wrote:
>
> What makes you say that -ls- is supposed to list the number of folders
> inside a folder? I can’t find any mention of it in neither
> -POSIX.1-2008-, -Linux Standard Base- nor in ‘GNU Coreutils’
> (http://tinyurl.com/3dx9g6). I might have overlooked something though.

The format is:


If the -l option is specified without -L, the following information
shall be written:

"%s %u %s %s %u %s %s
", <file mode>, <number of links>,
<owner name>, <group name>, <number of bytes in the file>,
<date and time>, <pathname>

Manual page ls(1p)

Probably all the fields have explanation, except “<number of links>”.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Looks like suse just list the number of hard links only.

But I can confirm that Angstrom Linux on a seperate machine of mine does list both subfolder count and no of hard links for directories.

I got this information from this source:
FTA - GNU/Linux Basic | FTA - Free Technology Academy

I dont know what is POSIX, Linux Standard Base and GNU Coreutils? Are they API specifications?

POSIX basically defines what UNIX is, including the API and utilities (like ls). The Linux Standard Base attempts to standardize GNU/Linux operating systems (basically detailing its differences and additions to POSIX), while GNU Coreutils is the implementation of utilities (including ls) usually included in GNU/Linux distributions (including openSUSE).

It’s a bit curious that Ångström would deviate from both normal practice and the relevant standards, I wonder what implementation of ls they’re using.

You could look what “ls --version” gives on both system to compare what
is the difference.


PC: oS 12.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.8.2 | GeForce GT 420
Eee PC: oS 12.1 x86_64 | Atom 330@1.60GHz | 3GB | KDE 4.8.2 | nVidia ION
eCAFE 800: oS 12.1 i586 | AMD Geode LX 800@500MHz | 512MB | KDE 3.5.10

Try


/bin/ls -l

That’s just in case your “ls” is an alias. Using the full path should bypass any alias.

an type ls to see what it is.

$ **type ls    **   
ls is aliased to `ls --color=auto'

$ **unalias ls**

$ **type ls**
ls is /bin/ls

On 2012-04-30 22:16, Quantumboredom wrote:

> It’s a bit curious that Ångström would deviate from both normal
> practice and the relevant standards, I wonder what implementation of ls
> they’re using.

Actually, my 11.4 oS do appear to count the number of directories (one of
the counts is the “…” directory, I think, and perhaps the “.” as well)


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Yes, odd isnt it?

Ive also noticed another difference with the ls command!!!

If you look at the filesize in bytes on suse 12.1 it states the full size of the directory including its contents.
While on Angstrom it just states the size of the folder on its own (without size of its contents!)

Regards
Aubrey.

On 2012-05-01 23:06, abourke wrote:

> Yes, odd isnt it?
>
> Ive also noticed another difference with the ls command!!!
>
> If you look at the filesize in bytes on suse 12.1 it states the full
> size of the directory including its contents.
> While on Angstrom it just states the size of the folder on its own
> (without size of its contents!)

I don’t see that behaviour.


cer@Telcontar:~/Download> l
total 803360
drwxr-xr-x  25 cer users      4096 Apr 30 23:23 ./
drwxr-xr-x 235 cer users     32768 May  1 14:56 ../
....
drwxr-xr-x   4 cer users      4096 Apr 30 23:58 Firefox_downloads/
drwxr-xr-x   2 cer users        41 Nov 14 14:35 Kobo/
drwxr-xr-x   2 cer users        33 Jul 17  2009 Moria/
drwxr-xr-x   2 cer users      4096 May 31  2011 Windows/


The “size” of the directories is not related to its size. Ah, in my case
that partition is type “xfs”. On /tmp, which is ext3, all directories I can
see have 4096 as “size”. No, one is “471040”, another “20480”. It may be
related to the number of inodes it contains.

I don’t see differences between 11.4 and 12.1.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)