• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

7 Useful Find Command Examples to Locate files to remove when a filesystem is full

by admin

“find” command can be very useful when it comes to locating files to remove when a filesystem is full. There are various options in find command to locate as well as remove the files consuming more space on the filesystem. Below are some of the find command examples, to locate files in various scenarios.

1. Here is the syntax to find files that are greater in size than 1 MB in the current directory:

# find . -size +1000000c -exec ls -l {} +

The -mount option to the find command can be used to restrict the search to the filesystem containing the directory specified. For example, it is not recommended to run find on /proc. Instead use:

# find / -mount

2. To find files generated by NFS and remove them if they are older than seven days:

# find / -name .nfs\* -mtime +7 -exec rm -f {} + -o -fstype nfs -prune

3. To search for core files starting at the root directory and delete them:

# find / -name core -exec rm {} +

4. To search for core files that have not been accessed in seven days and display them to the screen:

# find / -name core -atime +7 -print

5. To identify all files owned by a particular user and send a long listing of these files to the superuser:

# find / -user -ls | mailx -s "users files" root@hostname

6. Look for files that have not been modified in 90 days in the /home directory:

# find /home -mtime +90 -print

7. To find files that are greater than 400 blocks (512-byte blocks) and display the matching path names:

# find /home -size +400 -print

Filed Under: Linux, Solaris

Some more articles you might also be interested in …

  1. How To Read And Clear SCSI Reservations in Solaris 11 (sg3_utils)
  2. Understanding /etc/security/limits.conf file
  3. pmount: command not found
  4. colrm Command Examples in Linux
  5. i3 Command Examples in Linux
  6. LVM and multipathing – sample LVM filter strings
  7. dpkg: command not found
  8. kubectl: command not found
  9. How to uninstall mingw-w64 from Ubuntu
  10. Maintaining Linux filesystems using “fsck” and “tune2fs”

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright