Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

679
Visualizações
Linux Command , how to find files by size larger than x?

I'm trying to find files with size larger than "x" , ex: 32 bytes

But what I found in ls --help was only ls -S , that just sort by size and not satisfied my demand

I'm new to Linux , I've tried Google but I don't know what keywords should I use to find answer , could somebody give me advice , thank you !

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Try to use the power of find utility.

Find files greater than 32 bytes:

find -size +32c

Of course you could also ask for files smaller than 32 bytes:

find -size -32c

And files with exact 32 bytes:

find -size 32c

For files with 32 bytes or more:

find -size 32c -o -size +32c

Or not smaller than 32 bytes (the same as above, but written another way):

find ! -size -32c

And files between 32 and 64 bytes:

find -size +32c -size -64c

And you can also apply other common suffixes:

find -size +32k -size -64M
over 4 years ago · Santiago Trujillo Relatório

0

Try this:

find . -size +32c -ls

You can change 32 for the size you want. In this case, I used your example.

over 4 years ago · Santiago Trujillo Relatório

0

Explanation: Use unix command find Using -size oprator

The find utility recursively descends the directory tree for each path listed, evaluating an expression (composed of the 'primaries' and 'operands') in terms of each file in the tree.

Solution: According to the documentation

-size n[ckMGTP]
             True if the file's size, rounded up, in 512-byte blocks is n.  If n is fol-
             lowed by a c, than the primary is true if the file's size is n bytes (charac-
             ters).  Similarly if n is followed by a scale indicator than the file's size
             is compared to n scaled as:

             k       kilobytes (1024 bytes)
             M       megabytes (1024 kilobytes)
             G       gigabytes (1024 megabytes)
             T       terabytes (1024 gigabytes)
             P       petabytes (1024 terabytes)

Usage: perform find operation with -size flag and threshold measurement arguments: more than(+)/less than(-), number(n) and measurement type (k/M/G/T/P).

Formula: find <path> -size [+/-]<Number><Measurement>

Examples:

1.Greater Than - Find all files in my current directory (.) that greater than 500 kilobyte

find . -size +500k 

2.Less Than - Find all files in my current directory (.) that less than 100 megabyte.

find . -size -100M

3.Range - Find specific file (test) in my current directory (.) that greater than 500 kilobyte less than 100 megabyte (500k-1000k)

find . -name "test" -size +500k -size -100M

4.Complex Range with Regex Find all .mkv files in all filesystem (root /) that are greater than 1 gigabyte and created this month, and present info of them.

find / -name "*.mkv" -size +1G -type f -ctime -4w | xargs ls -la
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda