What command will remove all files named core in the home directories - ProProfs Discuss
Advertisement

What command will remove all files named core in the home directories of users(/home), that are more than 7 days old?

Asked by Lindsey, Last updated: Oct 30, 2021

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

John Smith

John Smith

John Smith
John Smith

Answered Sep 08, 2016

Find /home -mtime +7 -name core -exec rm -f {} \\;-to search the files or directories, we use the find or locate command where locate command search on its database but faster than find command. find command searches the files/directories in different condition but accurate than locate command. syntax for find command: find path condition action example: find /etc -name passwd : search files or directories in /etc named passwd. similarly you can use other options: -atime : access time -mtime : modified time -ctime : change time -name or -iname : according to file name -type : according to file type action in find command can start from -exec command. example: find /tmp -type f -exec rm {} \\; : which search all normal files and remove it. find /home -mtime +7 -name core -exec rm -f {} \\; : which searches files named core more than 7 days old and removes that file.
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.