List files that are larger than 100 kB
Clash 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
.
stat
New contributor
add a comment |Â
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
.
stat
New contributor
All files where? In one directory or everywhere on your system? What have you tried
â roaima
yesterday
add a comment |Â
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
.
stat
New contributor
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
stat
New contributor
New contributor
New contributor
asked yesterday
Quidam Ibidem
1
1
New contributor
New contributor
All files where? In one directory or everywhere on your system? What have you tried
â roaima
yesterday
add a comment |Â
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
add a comment |Â
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
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 bystat
command, otherwisefind -type f -size +100k
would works fine.
â Ravexina
yesterday
add a comment |Â
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
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 bystat
command, otherwisefind -type f -size +100k
would works fine.
â Ravexina
yesterday
add a comment |Â
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
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 bystat
command, otherwisefind -type f -size +100k
would works fine.
â Ravexina
yesterday
add a comment |Â
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
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
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 bystat
command, otherwisefind -type f -size +100k
would works fine.
â Ravexina
yesterday
add a comment |Â
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 bystat
command, otherwisefind -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
add a comment |Â
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.
Quidam Ibidem is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
All files where? In one directory or everywhere on your system? What have you tried
â roaima
yesterday