Score:0

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

cg flag

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.

in flag
The `-S` option will sort by size when using `ls`. You can also use `--sort=size`.
cg flag
Sorry, the above suggestions didn't help. Maybe I am entering incorrect command line. Is it possible to provide command line? Thank you.
Score:1
kr flag
 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 }'

cg flag
Your explanation, and command line helped me to accomplish my task. Thank you very much.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.