Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I delete all 'nohup.out' files within a directory recursively from my terminal? I'm using CentOS.

share|improve this question
Do you mean there are multiple files called nohup.out in subdirectories of one directory? If that's the case, try the following command: find . -name nohup.out -exec rm {} +. – Risto Salminen Jan 14 '14 at 11:41
You mean "within a directory?" What is the problem with rm nohup.out*? – Barun Jan 14 '14 at 11:42
Your question is somehow unclear, because there can't be more than one file with the particular name in one directory. – Risto Salminen Jan 14 '14 at 11:48
@RistoSalminen multiple nohup.out within one directory would not be good – Timo Jan 14 '14 at 11:48
up vote 7 down vote accepted

There can't be multiple files named nohup.out in a single directory, so I assume you mean that you want to remove it recursively:

find . -name nohup.out -exec rm {} +

If you are using GNU find, you can use -delete:

find . -name nohup.out -delete

In bash4+, you can also use globstar:

shopt -s globstar dotglob
rm -- **/nohup.out

Note, however, that globstar traverses symlinks when descending the directory tree, and may break if the length of the file list exceeds the limit on the size of arguments.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.