"Directory not empty" error occurs at the first attempt to remove an NFS share directory.

Solution Unverified - Updated -


  • It needs to delete twice the directory which under NFS share and shows "Directory not empty" error.
# mkdir test
# cd test/
# cat /etc/yum.conf > file1
# cat /etc/yum.conf >> file1
# cd ..
# rm -rf test/
# rm: cannot remove 'test/': Directory not empty

# cd test/
# ls -hl             # empty
# cd ..
# rm -rf test/      


  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content