stackoverflow.com-List files over a specific size in current directory and all subdirectories
stackoverflow.com-List files over a specific size in current directory and all subdirectories
subdirectories
stackoverflow.com /questions/13282786/list-files-over-a-specific-size-in-current-directory-and-all-
subdirectories
the first part of this is identical to @sputnicks answer, and sucesffully finds all files in the directory over 10k (don't
ls -
confuse k with K), my addition, the second part then executes lh or ls that lists(-l) the files by human
readable size(-h). negate the h if you prefer. of course the {} is the file itself, and the \+ is simply an alternative
to \;
ls -l found.file; ls -l found.file.2; ls -l
found.file.3
ls -l found.file found.file.2
found.file.3
Additionaly, you may want the listing ordered by size. Which is relatively easy to accomplish. I would at the -s
ls - sort -
option to ls, so ls and then pipe it to n to sort numerically
finally, your title says find biggest file in directory. You can do that by then piping the code to tail
note you could also sort files by size by using -S, and negate the need for sort. but to find the largest file you
would need to use head so
sort -
the benefit of doing it with -S and not sort is one, you don't have to type n and two you can also use -h
the human readable size option. which is one of my favorite to use, but is not available with older versisions of
ls, for example we have an old centOs 4 server at work that doesn't have -h
1/1