I am trying output the size of largest file found under /usr/share/help

After entering:

student@Ubuntu:~$ ls -laR /usr/share/help | awk '{print $5}' | sort -n | tail -l

I am getting this output:

4096
4096
4096
4096
4096
4096
4096
4096
4096
5001

If I enter this:

student@Ubuntu:~$ ls -laR /usr/share/help | awk '{print $5}' | sort -m | tail -l

I get this output:

465
701



4096
4096
1016
849
873

I believe both outputs above incorrect. Any suggestions, what commands I should enter to receive correct output. Thank you for your help.


 ls -lS /usr/share/help | grep ^- | head -n1

-S flag in ls sorts files in descending order,
-l is list display,
-R applies ls recursively, so all folders that are lower in the tree are also included

Then you just need to pipe it into grep and narrow the result down to files, which have '-' at the beginning of the line (^). Then show the first line and voilla.

You can show just the size, further piping the result into awk:

 ls -lS | grep ^- | head -n1 | awk -e '{ print $5 }'