title: Linux find command, find 10 latest files recursively regardless of time span
body: <p>What have I tried so far...</p>
  
  <p>Command:</p>
  
  <pre><code>find . -type f -ctime -3 | tail -n 5
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>./Mobilni Telefoni/01. Box Update/05. DC Unlocker Client/dc-unlocker_client-1.00.0857.exe
  ./Mobilni Telefoni/01. Box Update/39. Z3X Box/01. Update/01. Samsung Box/SamsungTool_12.4.exe
  ./Mobilni Telefoni/10. Nokia/1. SRPSKI  HRVATSKI  JEZICI/BB5/3xx_Series/Asha 300/06.97/rm781_06.97_ppm_d.rar
  ./GPS Navigacije/01. Garmin/03. Garmin Other/garmin_kgen_15.exe
  ./GPS Navigacije/01. Garmin/03. Garmin Other/test.txt
  </code></pre>
  
  <p>This output is OK, doesn't work good if I put wider time span. (notice I use -ctime and not -mtime because some uploaded files are modified few years ago)</p>
  
  <p>Problem is that files can be uploaded once a month, or once in a year, and I still need to get 10 latest files, regardless of time span.</p>
  
  <p>If it can't be done, does <code>tail</code> only limit output, or somehow just fetches number specified without huge performance impact on large number of files.</p>
  
  <p>By using command from one answer on SO, I was able to get the files but some files were missing...</p>
  
  <pre><code>find . -type f -printf '%T@ %p\n' | sort -n | tail -10 | cut -f2- -d" "
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>./Mobilni Telefoni/11. Samsung/1. FLASH FILES/1. SRPSKI HRVATSKI JEZICI/E/E2330/E2330_OXFKE2.rar
  ./Mobilni Telefoni/11. Samsung/1. FLASH FILES/1. SRPSKI HRVATSKI JEZICI/E/E2330/FlashTool_E2_R6.zip
  ./Mobilni Telefoni/11. Samsung/1. FLASH FILES/1. SRPSKI HRVATSKI JEZICI/E/E210/E210_XFGH2.rar
  ./Mobilni Telefoni/05. iPhone/07. iFaith/iFaith-v1.4.1_windows-final.zip
  ./Mobilni Telefoni/05. iPhone/09. iPhone Browser/SetupiPhoneBrowser.1.93.exe
  ./Mobilni Telefoni/05. iPhone/10. iPhone_PC_Suite/iPhone_PC_Suite_Eng_v0.2.1.rar
  ./Mobilni Telefoni/05. iPhone/10. iPhone_PC_Suite/iPhone_PC_Suite_Ok.rar
  ./test
  ./Mobilni Telefoni/11. Samsung/1. FLASH FILES/1. SRPSKI HRVATSKI JEZICI/E/E2152/E2152_XXJH4_OXFJI2.zip.filepart
  ./GPS Navigacije/01. Garmin/03. Garmin Other/test.txt
  </code></pre>
  
  <p>File <code>garmin_kgen_15.exe</code> is missing because it was created in 2008, but it was uploaded in last 24 hours.</p>