Find the answer to your Linux question:
Results 1 to 4 of 4
Hey all, I am a newbie here and with Linux so don't rip me a new one I am having an issue that I need to get resolved. The background ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    2

    Different Output from ls -f -l command between flavors of Linux question.

    Hey all, I am a newbie here and with Linux so don't rip me a new one

    I am having an issue that I need to get resolved. The background to the scenario is, a project at work is currently using a system running Red Hat 6. It is being accessed by another system (an HP system) to pull files for testing hardware. Basically, when it pulls the files, they are being pulled the same as what the "ls -f -l" command would return, so list format with the files listed alphabetically. So, an ls -f -l command outputs the files as A, B, C, D, etc.... in that order

    The project has implemented a new Linux box to replace the Red Hat 6 system and it is now running RHEL 5.2. When the HP system accesses this new Linux box to pull the same files, the output is returned with the files out of order, no longer in alphabetical order. The ls -f -l command on this new system returns the same set of files as B, D, A, C.... consistently in that order.

    The code that the HP box uses to access the files depends on the output to be in the A, B, C, D.... order (yeah, poor coding but it is an OLD system).

    Is there a way to change the output order that the ls -f -l command displays in RHEL 5.2 so that it will return the alphabetical order rather than whatever order it is currently outputting?

    I apologize if this is a bit confusing, I am not a Linux admin by any means but it has been handed to me to resolve. Any help would be greatly appreciated. Thanks in advance.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    On RHEL 5.x ls -l will return the files in order. If you want the "hidden" files that start with a dot, then use ls -al
    You might want to read the man page just to know exactly what you are doing.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    2
    Rubberman, yes, the ls -l command gives us exactly what we need but the coding that the HP system is using to poll the Linux machine is using the unsorted -f option. The guys who wrote the code (who are also the one's asking the IT staff to change how the -f option is output in RHEL 5.2) said that there is just way too much code to change and would like for that to be the last resort. So, if there is a way to change the output order of ls -f -l in the OS, then that is the route that would be easiest and most time and cost effective. I wish we could just tell the guys to change there code but they said that is a long and tedious task....

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Well, you could create a ~/bin directory and change the PATH environment variable for the user account to point to ~/bin first. Then create a shell script there for the 'ls' command that will convert the "ls -f -l" command to "/bin/ls -l". Every other option can be passed to /bin/ls as-is. There might be other ways to do this, but this will work and not affect any other accounts.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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