Tutorial: find files

Find files with the console:

  1. Find files by filename

    find / -name '*host*'
  2. Find files by type and name

    find /home -type f -name *.txt
  3. Find files by type, name and content

    find /home -type f -name *.txt | xargs grep Linux

    Identify the disk by "lable" and copy the "uuid".

  4. Find files modified within the last 5 days

    find /etc/ -mtime -5 -print
  5. Find files used (and locked) by a user "www-data"

    lsof -a -i -u www-data
  6. List folders sorted by their used space

    du -x / | sort -rn | more