Skip to main content

Search files & directories on Linux

Jose CerrejonLess than 1 minuteRaspberry PILinuxRaspberry PILinux

Search files & directories on Linux

Terminal
Terminal

Today we will learn how to search files and directories filtered with various parameters.


The command we use is find. Consider a few examples:


# find / -name -iname '*hta*' -size +100M -mtime +3

search:

  • The complete system (/)

  • All files or directories containing hta ('hta')

  • Ignoring case (-iname)

  • With size larger than 100MB (-size +100 M)

  • Files modified more than 3 days


# find / -empty

Find files and empty directories (-empty)

As a final command, the following will search the folder sizes ordered from lowest to highest:


# du -hs $(du -s * | sort -g | awk '{print $2}')

Link: BUSCANDO FICHEROS EN GNU/LINUX: COMANDO FINDopen in new window

Link: Tamaño de las carpetas ordenado de menor a mayoropen in new window