Find the answer to your Linux question:
Results 1 to 4 of 4
Hi , Whenever i try to execute ls with l as an option the system displays the output with significant delay. However only ls works fine. this happens only when ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2011
    Posts
    17

    execution delay for listing files.


    Hi ,

    Whenever i try to execute ls with l as an option the system displays the output with significant delay.
    However only ls works fine.

    this happens only when i m in /usr/local/sbin where all my executable resides.

    The workload on server is not more than 1.

    What could be the reason .

    Code:
    # which ls
    alias ls='ls --color=tty'
            /bin/ls
    Distribution details.
    Code:
    # lsb_release -a
    LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
    Distributor ID: EnterpriseEnterpriseServer
    Description:    Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
    Release:        5.2
    Codename:       Carthage
    Here is the difference .
    Code:
    #time ls
    real    0m0.004s
    user    0m0.000s
    sys     0m0.002s
    #time ls -ltr
    real    3m2.443s
    user    0m0.003s
    sys     0m0.002s

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,598
    As you surmise, the aliased "ls" command may be at fault. Try running the command "/bin/ls -ltr" and see how that works.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,569
    Well the t flag sorts by modification time and then the r flag reverses the order, so maybe if there are a lot of files in that directory the sort is taking time, try running the following to identify which flag is slowing it down

    Code:
    time ls
    time ls -l
    time ls -t
    time ls -r
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  4. #4
    Just Joined!
    Join Date
    Mar 2011
    Posts
    17
    Quote Originally Posted by elija View Post
    Well the t flag sorts by modification time and then the r flag reverses the order, so maybe if there are a lot of files in that directory the sort is taking time, try running the following to identify which flag is slowing it down

    Code:
    time ls
    time ls -l
    time ls -t
    time ls -r
    It was a problem of ownership .When i tried executing ls -n it resulted in faster responce .
    -n option make sure that only uid and gid are displayed.

    So i figured out that one of the folder has wrong ownership.
    I changed the ownership of the folder and the problem is solved.

Posting Permissions

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