Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-10-2009, 12:36 PM   #1
LQ Newbie
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Question about "ls -f -l" command output in RHEL 5.2 and Red Hat 6

Hey all, I am just here hoping someone can help me out with a problem.

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.
Old 06-10-2009, 04:49 PM   #2
Senior Member
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
from the man page:

-f do not sort, enable -aU, disable -ls --color
so you can rid of this peculiar output by not specifying -f. that may not be what you want, but it will be different.

If you really want to gain control, you may have to pipe the output through something else (sort, awk?) to sort it into the order that you want, if you can define that.
Old 06-11-2009, 06:48 AM   #3
LQ Newbie
Registered: Jun 2009
Posts: 2

Original Poster
Rep: Reputation: 0
salasi, yeah, that is what we were thinking but the code that accesses the data depends on the order of the output looking like the order supplied by the -f command. It was coded poorly and the group using the code (who also wrote the code) said it is a ridiculous amount of code to change and are looking for a way to change the output through the OS. Unfortunately, from our IT department's standpoint, the code is not going to change unless it is the last resort. The output we need it to pull is what the standard ls -l output gives us (sorted) but unfortunately the code pulls it with the -f option (unsorted), which is now different in RHEL 5.2.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Red Hat Ent. Linux "AS"/"ES" wardialer Linux - Newbie 7 02-11-2011 06:39 AM
square brackets in output of "ps aux" not matching output of "ps -ejH" alirezan1 Linux - Newbie 14 07-14-2010 04:17 AM
Feeding the output of "diff" or "cat" command to dpkg --purge kushalkoolwal Debian 9 06-19-2008 07:27 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
How to install "make" command from rpm on cd 2 - red hat linux 7.0 ZARGON Linux - Newbie 2 08-31-2004 10:53 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration