Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: console ls command displaying incorrect information

  1. #1

    Default 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

  2. #2

    Default Re: console ls command displaying incorrect information

    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.

  3. #3
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: console ls command displaying incorrect information

    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:

    Code:
    If the -l option is specified without -L, the following information
    shall be written:
    
    "%s %u %s %s %u %s %s\n", <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)

  4. #4

    Default Re: console ls command displaying incorrect information

    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?

  5. #5

    Default Re: console ls command displaying incorrect information

    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.

  6. #6
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: console ls command displaying incorrect information

    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

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,370
    Blog Entries
    3

    Default Re: console ls command displaying incorrect information

    Quote Originally Posted by abourke View Post
    When I type "ls -l" into the console
    Try
    Code:
    /bin/ls -l
    That's just in case your "ls" is an alias. Using the full path should bypass any alias.
    openSUSE Leap 15.1; KDE Plasma 5;

  8. #8

    Default Re: console ls command displaying incorrect information

    an type ls to see what it is.


    Code:
    $ type ls       
    ls is aliased to `ls --color=auto'
    
    $ unalias ls
    
    $ type ls
    ls is /bin/ls

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: console ls command displaying incorrect information

    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)

  10. #10

    Default Re: console ls command displaying incorrect information

    Quote Originally Posted by robin_listas View Post
    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.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •