[solved] ls | find not piping

New to Debian (Or Linux in general)? Ask your questions here!

[solved] ls | find not piping

Postby pata » 2020-03-09 19:11

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.
pata
 
Posts: 5
Joined: 2020-03-09 19:05

Re: ls | find not piping

Postby sunrat » 2020-03-09 20:45

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!
User avatar
sunrat
 
Posts: 3125
Joined: 2006-08-29 09:12
Location: Melbourne, Australia


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable