[Top][All Lists]

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

Re: "ls" bug

From: Bob Proulx
Subject: Re: "ls" bug
Date: Thu, 21 Dec 2006 18:11:49 -0700
User-agent: Mutt/1.5.9i

Dedeco wrote:
>   I am surprise nobody noted that there is no way to list the real size 
> of the files, in the line "ls -sh". It is só much commom that one will 
> want to see the real size of the file, instead of the block size of a 
> file.

Apparently this has not been a serious need previously or it would
have been requested more often.  Itches get scratch, as they say.

> And the long listing is not an option, since it will not list
> several files on a line, will occupy a lot of space, and visually
> pollute the listing with unwanted information.

The normal thing to do would be to use just the fields that you want
from it.  Something like this will give you what you want.

  ls -ldog --time-style=long-iso foo bar | awk '{print$3,$6}'

But the 'stat' command is probably more suited.  You might want to try
something like this.

  stat --format '%s %n' foo bar

Both of these are a little more typing if needed on the command line
but this is something that is more generally only needed in scripts.
If it is something that you want on the command line often then a
script can be written easily.

  exec stat --format '%s %n' "$@"

Hope that helps,

reply via email to

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