Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[solved] ls | find not piping

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
pata
Posts: 5
Joined: 2020-03-09 19:05

[solved] ls | find not piping

#1 Post by pata »

ls -tr | find -type f -name "*" -size +1M
find -type f -name "*" -size +1M | ls -tr

I am trying to find all files larger than 1MB and list them in chronological order.
But both ways is not piping properly.
Last edited by pata on 2020-03-12 19:30, edited 1 time in total.

User avatar
sunrat
Administrator
Administrator
Posts: 6497
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 476 times

Re: ls | find not piping

#2 Post by sunrat »

You forgot to give find a location to search for starters.

Code: Select all

find . -type f -size +1M -print0 | xargs -0 ls -halt
That will recursively find all files in current directory. Add -maxdepth 1 to find if you don't want it to search subdirectories. Add -r to ls if you want it to show oldest to newest.

This came up as the first result at StackExchange using a Startpage search for the term "find all files larger than 1MB and list them in chronological order". Search is much faster than a forum question usually. ;)
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Post Reply