bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QSH LS Info


From: Bob Proulx
Subject: Re: QSH LS Info
Date: Tue, 5 May 2009 23:00:12 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

Bocchino, Frank wrote:
> Hi Bob and thanks for responding.

Please keep the mailing list in the CC list.  That way all may
participate in the discussion, can correct my mistakes, and all of us
can learn from the result.  This is normally done by group replying to
all.  Unless your mailer has a list-reply feature in which case that
is even better.

> I'm on an AS400, which I assume has something to do w/my issue.

It really depends on if you have the coreutils from the GNU Project
installed or not.  It seems not.

> When I run ls --version here's what I get;
>    ls: 001-3015 usage: ls [-ACFLRSTacdfiloqrstu1] [file ...]
>    Press ENTER to end terminal session.   

That is not the GNU 'ls' command.  That looks to me like the IBM 'ls'
command.  This is why the -S option isn't doing what the GNU command
does.

> When I run ls --help | grep -e -S here's what I get;
>    ls: 001-3015 usage: ls [-ACFLRSTacdfiloqrstu1] [file ...]
>    grep: 001-3010 usage: grep [-E | -F] [-c | -l | -q] [-ihnsvwxy] [-e
> pattern_list] [-f pattern_file] [pattern] [file ...]
>    Press ENTER to end terminal session.    
> So, I'm not sure why they don't work but if I have to use 

You are running the IBM version of the ls command.  It does not
contain all of the fancy enhancements that the GNU version of the
program contains.  Which makes sense since you say you
are on an IBM AS400.

You would need to read the IBM documentation on the IBM 'ls' command
and use what it provides.  Or you might want to install the GNU
coreutils as well if you wish to use them instead.

> ls -al | sort -k5,5nr
> 
> What will that cmd do?  What's the -k5,5nr mean?   

The Unix philosophy is that small programs are built in such a way
that they can be combined together and create by the combination more
powerful programs.  The above is one example.  It will pipe the output
of ls into sort and will sort it based upon the 5th column,
numerically, in reverse order.  The 5th column is the file size.  This
does what you asked but in a standard way using only features found on
every system everywhere.

Sort is a generic program and will work with most other programs in
this way.  So instead of trying to have ls do this it is easy to chain
programs together to produce the result you want.  The sort
documentation would describe the features of sort in detail.

> What would you recommend as the best way to learn what all the
> switches/options on each cmd and what they mean? 

That is hard to answer not because there isn't a good resource but
instead because there are so very many good resources.  Search the web
for shell scripting and you will find many tutorials, guides and
references.  I really don't know one I would recommend over another.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]