bug-coreutils
[Top][All Lists]
Advanced

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

Re: Showing actual filesizes with ls


From: Joakim Rosqvist (JRO.SE)
Subject: Re: Showing actual filesizes with ls
Date: Sun, 23 Jan 2005 23:24:31 +0100

 
> "Joakim Rosqvist (JRO.SE)" <address@hidden> writes:
> 
> > I would like to see a new option to ls that works like --size (showing
> > filenames and sizes in as many columns as will fit onscreen), but shows
> > filesize instead of disk usage.
> 
> Isn't this need fairly specialized?  Couldn't you implement it
> with a script?

ls --apparent-size would give more useful information: you could see 
at a glance whether a file is empty, contains just a few lines
or a full page of text. ls -s just says 4kb in all those cases.
I'd say that would be of value to more people than me.

The column formatting of ls is not trivial; it considers length of filenames
and sizes, tries to minimize the number of lines, can sort by lines as well
as by columns. It would be a difficult wheel to re-invent.

> > what would be the best size to show for a symlink: the size of the
> > link or the size of the file referred to?
> 
> As Jim mentioned that should be controlled by whether the link is
> dereferenced.

Agreed, and that works already.

> Also, what would ls show for files that are neither regular files nor
> symlinks?  E.g., what "size" would it show for character devices?

For now, it will be a zero (which is what ls -s also shows), as that is
what the size field of the inode gives.  Showing major/minor-numbers
is an interesting idea ("show what ls -l would have shown").

/Joakim





reply via email to

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