The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 02-04-2005
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,125
'du -s' - includes directories
the 'find' solution above is recursive

largest FILE in the CURRENT directory
find . ! -name . -prune -type f -ls | sort -r -k 7,7 | head -1

Assuming the file name does contain embedded space [in ksh]:
A=$(find . ! -name . -prune -type f -ls | sort -r -k 7,7 | nawk 'FNR==1{print $NF; exit}')