List files that are larger than 100 kB

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-3
down vote

favorite












I would like to list all the files in ~ whose size is greater than 100 kB but without using the find command. I need to do it with stat.










share|improve this question







New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • All files where? In one directory or everywhere on your system? What have you tried
    – roaima
    yesterday














up vote
-3
down vote

favorite












I would like to list all the files in ~ whose size is greater than 100 kB but without using the find command. I need to do it with stat.










share|improve this question







New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • All files where? In one directory or everywhere on your system? What have you tried
    – roaima
    yesterday












up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I would like to list all the files in ~ whose size is greater than 100 kB but without using the find command. I need to do it with stat.










share|improve this question







New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I would like to list all the files in ~ whose size is greater than 100 kB but without using the find command. I need to do it with stat.







stat






share|improve this question







New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Quidam Ibidem

1




1




New contributor




Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Quidam Ibidem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • All files where? In one directory or everywhere on your system? What have you tried
    – roaima
    yesterday
















  • All files where? In one directory or everywhere on your system? What have you tried
    – roaima
    yesterday















All files where? In one directory or everywhere on your system? What have you tried
– roaima
yesterday




All files where? In one directory or everywhere on your system? What have you tried
– roaima
yesterday










1 Answer
1






active

oldest

votes

















up vote
1
down vote













stat can't list files based on a condition, but you can combine find and stat to get them work together:



find -type f -size +100k -exec stat +


or to get specific outout for example files permissions:



find -type f -size +100k -exec stat -c %a +



Or write a script which only uses stat:



#!/bin/bash
for file in $HOME/*; do
if [ -f "$file" ] && [[ $(stat -c %s "$file") -ge 100000 ]]; then
echo "$file"
fi
done





share|improve this answer


















  • 1




    Thanks. But if I use find, why don't just use find -type f -size +100k ?
    – Quidam Ibidem
    yesterday






  • 1




    I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
    – Ravexina
    yesterday










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Quidam Ibidem is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473751%2flist-files-that-are-larger-than-100-kb%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













stat can't list files based on a condition, but you can combine find and stat to get them work together:



find -type f -size +100k -exec stat +


or to get specific outout for example files permissions:



find -type f -size +100k -exec stat -c %a +



Or write a script which only uses stat:



#!/bin/bash
for file in $HOME/*; do
if [ -f "$file" ] && [[ $(stat -c %s "$file") -ge 100000 ]]; then
echo "$file"
fi
done





share|improve this answer


















  • 1




    Thanks. But if I use find, why don't just use find -type f -size +100k ?
    – Quidam Ibidem
    yesterday






  • 1




    I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
    – Ravexina
    yesterday














up vote
1
down vote













stat can't list files based on a condition, but you can combine find and stat to get them work together:



find -type f -size +100k -exec stat +


or to get specific outout for example files permissions:



find -type f -size +100k -exec stat -c %a +



Or write a script which only uses stat:



#!/bin/bash
for file in $HOME/*; do
if [ -f "$file" ] && [[ $(stat -c %s "$file") -ge 100000 ]]; then
echo "$file"
fi
done





share|improve this answer


















  • 1




    Thanks. But if I use find, why don't just use find -type f -size +100k ?
    – Quidam Ibidem
    yesterday






  • 1




    I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
    – Ravexina
    yesterday












up vote
1
down vote










up vote
1
down vote









stat can't list files based on a condition, but you can combine find and stat to get them work together:



find -type f -size +100k -exec stat +


or to get specific outout for example files permissions:



find -type f -size +100k -exec stat -c %a +



Or write a script which only uses stat:



#!/bin/bash
for file in $HOME/*; do
if [ -f "$file" ] && [[ $(stat -c %s "$file") -ge 100000 ]]; then
echo "$file"
fi
done





share|improve this answer














stat can't list files based on a condition, but you can combine find and stat to get them work together:



find -type f -size +100k -exec stat +


or to get specific outout for example files permissions:



find -type f -size +100k -exec stat -c %a +



Or write a script which only uses stat:



#!/bin/bash
for file in $HOME/*; do
if [ -f "$file" ] && [[ $(stat -c %s "$file") -ge 100000 ]]; then
echo "$file"
fi
done






share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered yesterday









Ravexina

1,305721




1,305721







  • 1




    Thanks. But if I use find, why don't just use find -type f -size +100k ?
    – Quidam Ibidem
    yesterday






  • 1




    I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
    – Ravexina
    yesterday












  • 1




    Thanks. But if I use find, why don't just use find -type f -size +100k ?
    – Quidam Ibidem
    yesterday






  • 1




    I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
    – Ravexina
    yesterday







1




1




Thanks. But if I use find, why don't just use find -type f -size +100k ?
– Quidam Ibidem
yesterday




Thanks. But if I use find, why don't just use find -type f -size +100k ?
– Quidam Ibidem
yesterday




1




1




I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
– Ravexina
yesterday




I thought you might want to get your output by stat command, otherwise find -type f -size +100k would works fine.
– Ravexina
yesterday










Quidam Ibidem is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Quidam Ibidem is a new contributor. Be nice, and check out our Code of Conduct.












Quidam Ibidem is a new contributor. Be nice, and check out our Code of Conduct.











Quidam Ibidem is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473751%2flist-files-that-are-larger-than-100-kb%23new-answer', 'question_page');

);

Post as a guest













































































rCWNp61muDyzgNV,Qjlq9V,qts6MV5R wmWl,eH87SolwZOG9bvFRfI5GJbP6762,fKHY1,z,k CW4R,rQSU,jo,Ndlnl16uaXl G5T CvYCdg
MaWU7vDwJM0cb B8Xw6rlAwSqk,Rksyeo

Popular posts from this blog

How to check contact read email or not when send email to Individual?

How many registers does an x86_64 CPU actually have?

Displaying single band from multi-band raster using QGIS