size counter

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
woflux
Posts: 22
Joined: Tue 11 Sep 2012, 16:03

size counter

#1 Post by woflux »

Hello,

I have a folder full of files and Id like Linux to list the name of files with same size, how can I do this ?

slenkar
Posts: 228
Joined: Sat 11 Jul 2009, 01:26

#2 Post by slenkar »

how about menu-filesystem-graphical disk usage

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#3 Post by SFR »

Hmm, quite unusual problem, but let's try...
In a bit tricky way (to handle filenames with spaces properly), but this one-liner should do what you wish.
Open terminal window in desired folder and type/paste this:

Code: Select all

find . -type f -print0 | xargs -0 du -b | sort -h | tr " " "`echo -e '\x01'`" | rev | uniq -D -f1 | rev | tr "`echo -e '\x01'`" " "
(the output will be: size_in_bytes filename)

I'm sure there must be more elegant way (probably in awk), but we have to wait for an expert. ;)

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#4 Post by Flash »

If you don't mind using ROX, first click the "Show extra details" view, then click the column heading called "Size." This will order the files in the folder in ascending (or descending, if you click the "Size" heading twice) order of size. If two files are the same size, they will be adjacent in the list.

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

#5 Post by Ibidem »

Code: Select all

 ls -sS
Only gives size in kilobytes, unfortunately.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#6 Post by vovchik »

This gives "human-readable"size (i.e k, M, G):

Code: Select all

ls -sSh
with kind regards,
vovchik

Post Reply