Wednesday, 2 August 2017

Delete large no of file in Linux -bash: /bin/find: Argument list too long

Error:::

[root@said audit]# ls -l | wc -l
173460

[root@said audit]# find /var/lib/oracle/grid/rdbms/audit/*.aud -mtime +2 -exec rm {} \;
-bash: /bin/find: Argument list too long

Solution: Delete large no of file generated in linux server using the following command

[root@said audit]# find /var/lib/oracle/grid/rdbms/audit -type f -name "*.aud" | xargs rm -f
[root@said audit]# clear
[root@said audit]# ls -l | wc -l
50