Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Two questions on find with rm command Post 302948132 by John K on Friday 26th of June 2015 04:37:48 AM
Old 06-26-2015
Two questions on find with rm command

Version: Oracle Linux 6.4

In the below directory, we had 1.6 million audit log files with the extention .aud which are older than 20 days .

I ran a find with rm command as shown below. But, I had to cancel the execution of the below command after 4 hours as I don't want to run a long running command during peak hours

find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +20 -exec rm -f {} \;

Question1.Is there a way I could tweak this command to run faster ?

This server has no shortage of CPUs. It has 40 CPU cores ( 80 cores when Hyperthreading is considered ). It has 256G RAM too.

Later I realized that this directory has files which are older than 500 days. So, I should have done this in chunks ; 100 at time as shown below.

Code:
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +500 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +400 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +300 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +200 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +100 -exec rm -f {} \;
find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +20 -exec rm -f {} \;

So, I ran the following command to delete files older than 500 days. But it still took 32 minutes to delete 76,000 files !!

Code:
$ find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +500 | wc -l
76099
$ find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +500 -exec rm -f {} \;

So, I would like to know if there is a way I could tweak this command to run faster ?

Question2.

find /u01/product/11.2.0/rdbms/audit -name '*.aud' -mtime +20 -exec rm -f {} \;

During the above mentioned find and rm command execution , from another session, I tried to run an ls command on this directory to see how many files are remaining. But, I got the below error

Code:
$ pwd
/u01/product/11.2.0/rdbms/audit
$ ls -alrdt *.aud | wc -l
-bash: /bin/ls: Argument list too long
0

Is there a way I could see the progress of this command with something like a progress bar?

Last edited by John K; 06-26-2015 at 11:54 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

unix command questions?

I read the description of the less command and I'm puzzled that it says you can go backwards while using more(1). I created a large file and when I run the more command on it I can move forward with the spacebar and move backward with the letter 'b'. Granted, the less command has more command... (2 Replies)
Discussion started by: wmosley2
2 Replies

2. Shell Programming and Scripting

Dummy questions about how to get the size of a directory by command

Hi, 'ls -ld' is no use .... I want to get the total size of a directory including subdir. Any advice? Thanks in advance (2 Replies)
Discussion started by: GCTEII
2 Replies

3. UNIX for Dummies Questions & Answers

I have a questions about mail command

Any possibility to send a mail to internal mail using mail command? i am using fedora7. Example: username@192.168.1.1 (1 Reply)
Discussion started by: btech_raju
1 Replies

4. UNIX for Dummies Questions & Answers

Questions on GREP command

Hi, Is it possible to display a specific number of lines starting from a line having a particular text using grep command? e.g. I have a text file with the contents below: AAA BBB CCC DDD EEE FFF I want to display 3 lines starting with the line having "BBB" to get the result below:... (11 Replies)
Discussion started by: stevefox
11 Replies

5. UNIX for Dummies Questions & Answers

command questions

Hi, can anyone answer the following questions? 1.How do you check for particular exception in a growing log file? 2.How do you terminate a long running process? What if there are multiple instances running? Thanks James (1 Reply)
Discussion started by: james94538
1 Replies

6. UNIX for Dummies Questions & Answers

More find command questions

Last week I was helped in finding certain filenames and removing them using the following command and it worked fine. find /path/to/files -name 'WQ*' -type f -exec rm -f {} \; This week, I need to find certain characters within a certain file. For example, I need to find scripts that... (2 Replies)
Discussion started by: NycUnxer
2 Replies

7. Solaris

2 questions regarding the WGET command

I'm using the "wget" command to get the date from Yahoo.com. So this is what I use on Solaris: /usr/sfw/bin/wget --timeout=3 -S Yahoo! This works well when my computer is linked to the Net. But when it's not, this command just hangs. I thought putting the timemout = 3 will make this... (2 Replies)
Discussion started by: newbie09
2 Replies

8. Shell Programming and Scripting

Questions about the crypt command

hi all, My aim is to encrypt a file using 'crypt' command. Which is the package I need to install to get this command work? (because it says, crypt: command not found ) I'm working on a NetBSD 3.1 machine.. please help (1 Reply)
Discussion started by: renjumc
1 Replies

9. UNIX for Dummies Questions & Answers

find command, "basic" questions

find $HOME \ ( \( -name ´*.bak´ -ctime +20 \) -o \ \( -size 0 -user kurs00 \) \) -exec rm -i {} \; -print this is the syntax, i know what -name, -ctime and so on means, but i don't know what the -o or the \\ or the () or the {} mean. Can someone please explain? I searched the internet, I... (4 Replies)
Discussion started by: Dr. Nick
4 Replies
DOVEADM-LOG(1)							      Dovecot							    DOVEADM-LOG(1)

NAME
doveadm-log - Locate, test or reopen Dovecot's log files SYNOPSIS
doveadm [-Dv] log errors [-s min_timestamp] doveadm [-Dv] log find [directory] doveadm [-Dv] log reopen doveadm [-Dv] log test DESCRIPTION
The doveadm log commands are used to locate and reopen the log files of dovecot(1). It's also possible to test the configured targets of the *log_path settings. OPTIONS
Global doveadm(1) options: -D Enables verbosity and debug messages. -v Enables verbosity, including progress counter. COMMANDS
log errors doveadm log errors [-s min_timestamp] The log errors command is used to show the last - up to 1,000 - errors and warnings. If no output is generated, no errors have occurred since the last start. -s min_timestamp An integer value, representing seconds since the epoch - also known as Unix timestamp. When a min_timestamp was given, doveadm(1) will only show errors occurred since that point in time. log find doveadm log find [directory] The log find command is used to show the location of the log files, to which dovecot(1) sends its log messages. If dovecot(1) logs its messages through syslogd(8) and doveadm(1) could not find any log files, you can specify the directory where your syslogd writes its log files. log reopen doveadm log reopen This command causes doveadm to reopen all log files, configured in the log_path, info_log_path and debug_log_path settings. These settings are configured in /etc/dovecot/conf.d/10-logging.conf. This is for example useful after manually rotating the log files. log test doveadm log test This command causes doveadm to write the message "This is Dovecot's priority log (timestamp)" to the configured log files. The used prior- ities are: debug, info, warning, error and fatal. EXAMPLE
This example shows how to locate the log files used by dovecot(1). doveadm log find Looking for log files from /var/log Debug: /var/log/dovecot.debug Info: /var/log/mail.log Warning: /var/log/mail.log Error: /var/log/mail.log Fatal: /var/log/mail.log REPORTING BUGS
Report bugs, including doveconf -n output, to the Dovecot Mailing List <dovecot@dovecot.org>. Information about reporting bugs is avail- able at: http://dovecot.org/bugreport.html SEE ALSO
doveadm(1) Dovecot v2.2 2013-11-24 DOVEADM-LOG(1)
All times are GMT -4. The time now is 10:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy