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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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 Configure Persistent Names for Tape Devices in CentOS/RHEL
  2. 11 Useful “ssh” and “scp” Commands in Linux
  3. Beginners Guide to Global File System 2 (GFS2)
  4. How to Move Swap From Disk Partition to LVM Volume in Linux
  5. How to Use the Oracle Solaris Fast Crash Dump Feature
  6. RHEL / CentOS : How to shrink LVM volume
  7. UNIX / Linux : What is the correct permission of /tmp and /var/tmp directories
  8. CentOS / RHEL : How to add, delete and display LVM tags
  9. Understanding Basic File Permissions and ownership in Linux
  10. How to create an OBP boot device alias in Solaris [SPARC]

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary