1

I am doing a homework which ask me to find the smallest file and biggest file under the directory, I have done that. But my output is something like "the smallest file is xxx (xxxx -'filename' bytes) I wish I could print something without the filename part. I am using du -b $filename to get the size.

1 Answers1

0

du -b | sort -rh | head -n 1 | awk '{print "The smallest file is " $1 " bytes"}'

Rawkode
  • 21,990
  • 5
  • 38
  • 45