Q:

How to print only the largest file in a directory in Linux?

I would like to know how can i sort a directory and print out to the terminal only the largest file in that specific directory?
This is my directory:

file1 2
file2 3
file3 1
file4 5
file5 2

The wanted result is to print "file4" to the terminal

A:

For just files in the directory you can use this:
ls -Shld * | head -n 1

To include directories you can us du:
du -a * | sort -n -r | head -n 1

