The Linux find command is useful for finding files on your Linux system. It is possible to look for more than one file type.
This example will search for all text and png files under the /usr/share directory.
jason@neo:/usr/share$ find -regex '.*txt\|.*png' |
This example will search for three different file types.
jason@neo:/usr/share$ find -regex '.*txt\|.*png\|.*gz' |
Use wildcards like this to find specific file types.
jason@neo:/usr/share/doc$ find . -name \*.gz -print |
search only 2 levels deep into directories to find a certain file.
root@neo:/home/jason# find / -maxdepth 2 -name "meminfo" /proc/meminfo |
Use the find command to find all files that changed in the past 5 minutes.
root@neo:/home/jason# find / -maxdepth 2 -cmin 5 /tmp/tracker-extract-files.1000 /home/jason /var/tmp |
The locate command is another way to find files on your filesystem. In this example, I am finding all files in the / directory that are named vmlinux.
root@neo:/home/jason# locate vmlinux /usr/src/linux-headers-3.16.0-4-common/include/asm-generic/vmlinux.lds.h |
Find the space hogging files on your Linux system.
jason@neo:~$ lsof / | awk '{if($7 > 1048576) print $7/1048576 "MB" " " $9 }' | sort -n -u | tail 3.61054MB /usr/bin/python2.7 4.29156MB /usr/lib/x86_64-linux-gnu/libgtkmm-2.4.so.1.1.0 4.29343MB /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.25 5.66222MB /usr/lib/x86_64-linux-gnu/libmozjs-24.so.0.0.0 6.70585MB /usr/lib/x86_64-linux-gnu/libgtk-3.so.0.1400.5 6.91679MB /usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-3.0.so.0.16.17 7.79662MB /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so 22.4236MB /usr/lib/x86_64-linux-gnu/libicudata.so.52.1 29.0516MB /usr/lib/x86_64-linux-gnu/libLLVM-3.5.so.1 31.6988MB /usr/lib/x86_64-linux-gnu/libwebkitgtk-3.0.so.0.22.15 |