Find command with some examples
Find command is available by default in most of the Linux distros so you don’t need to install any packages to get this command. Find command is very useful to search it for a particular file based on various search criteria like permissions, ownership, modifcation of date/time etc., Using find command even you can search it for specific files and remove it. We will see below with some examples of Find command.
1. Finding files with particular extension.
# find /etc/ -type -f -name "*.conf"
2. Finding files using the name in current directory
# find . -name "test.txt"
3. Find and remove zero size files
Removing the zero byte files in current directory.
# find . -size 0 -exec rm {} \;
Suppose if you want to remove the empty files in /tmp directory likewise you can remove it in any directory
# find /tmp -size 0 -exec rm {} \;
Share This Post:
more news from the blog