• 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

How to Delete the Files Which are Older Than n Days WITHOUT Using find Command

by admin

Question: How to delete the files which are older than n days WITHOUT use find command?

For some reason, the find command is not used to check which files are older than n days, as a substitute, ‘tmpwatch‘ can be used

The syntax is:

# tmpwatch [time in hours] [directory]

For example, to delete files under /root/testdir/ not accessed for last 45 days ( 24×45 = 1018 hours), run the following command:

# tmpwatch 1080 /root/testdir/

You could also specify the atime/mtime/ctime etc, to learn more, please check

$ man tmpwatch

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Fedora, Linux

Some more articles you might also be interested in …

  1. nmtui: command not found
  2. CentOS / RHEL : iptables troubleshooting guide
  3. “Failed to Start Activation of LVM2 Logical Volumes” and “Unit lvm2-activation-net.service Entered Failed State” – CentOS/RHEL 7 booting issue
  4. scp Command Examples in Linux
  5. How to Restart Network Services in CentOS/RHEL 8
  6. edquota Command Examples in Linux
  7. xargs: command not found
  8. How to generate PGP keys using GPG on Linux
  9. How to configure VNC Server on Oracle Linux 6
  10. How to Mount Guest Qcow2 Virtual disk Image containing LVM on KVM Host Machine

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright