Here’s some find command tips for the DBAs to save time performing day-to-day tasks.

1. Removing files older than 14 Days from the current working directory

find . -type f -mtime +14 -exec rm -f {} \;

2. Finding the top 5 largest files from the current working directory

find . -ls | sort -nrk 7 | head -5

3. Find files larger than 100MB from the current working directory

find . -size +100000k

4. Delete audit records that’s older than 30 days

find $ORACLE_HOME/rdbms/audit -name "*.aud" -mtime +30 -exec rm {} \;

5. Delete files in /tmp that’s older than 30 days

find /tmp -group dba -type f -mtime +5 -exec rm -f {} \;
find /tmp/dba -group dba -type f -mtime +5 -exec rm -f {} \;

6. Delete *.trc files more than 5 days old.

find $TRACE_DIR -name '*.trc' -type f -mtime +5 -exec rm {} \;
Posted in Linux
Share this post, let the world know

Comments are closed