How Find Non Empty Files in Linux?
Contents by Default, the Find Command Excludes Symbolic Files. Use the -L Option to Include Them. the Expression -Maxdepth 1 Specifies That the Maximum Depth...
Contents
By default, the find command excludes symbolic files. Use the -L option to include them. The expression -maxdepth 1 specifies that the maximum depth to which the search will drill is one only. By default, the find command will recursively go down the directory.
How check non empty files in UNIX?
Check If File Is Empty Or Not Using Shell Script
- touch /tmp/file1 ls -l /tmp/file1 find /tmp -empty -name file1.
- echo “data” > /tmp/file2 ls -l /tmp/file2 find /tmp -empty -name file2.
- touch /tmp/f1 echo “data” >/tmp/f2 ls -l /tmp/f{1,2} [ -s /tmp/f1 ] echo $?
- [ -s /tmp/f2 ] echo $?
How do I find unused files in Linux?
What is the Linux command to find and delete unused files?
- find /home -atime +365.
- In the example above, all files from the /home directory is searched where the last accessed (atime) is older than 365 days.
- This will give an accurate overview of which files haven’t been accessed in XX number of days.