• 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

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. 7 Useful Find Command Examples to Locate files to remove when a filesystem is full
  2. Understanding Linux SCSI Reservation
  3. CentOS / RHEL : How To Check FC Brocade HBA Firmware
  4. Understanding the Network interface configuration file /etc/sysconfig/network-scripts/ifcfg-eth#
  5. How to allow or deny telnet login to specific users only in CentOS/RHEL
  6. How To Create/Remove and Mount a Stratis Filesystem in CentOS/RHEL 8
  7. CentOS / RHEL : How to make iptable rules persist across reboots
  8. CentOS / RHEL 5 : How to use the faillog command to track failed login attempts
  9. CentOS / RHEL 6 : How to disable Transparent Huge pages (THP)
  10. How to Configure Multiple Fencing-device Levels in Pacemaker Cluster

You May Also Like

Primary Sidebar

Recent Posts

  • How to Configure Automatic Package Updates on the Server in CentOS/RHEL 8
  • FATAL: Error inserting rds_rdma
  • Failed to start LSB: Bring up/down networking – On restarting network service CentOS/RHEL (DHCP client)
  • How To Add Timestamps To dmesg Kernel Boot Log in CentOS/RHEL
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary