Deleting a directory in Linux is easy; choosing the right command for what’s inside it takes a little more care. rmdir stops if anything remains. rm -r deletes a directory tree, so a typo or unexpected path can remove more than you intended. Choose the command by what you want removed For an empty directory, use rmdir : rmdir dirname It removes the directory only if it is empty. Hidden files count as contents, so a directory that looks empty in a regular ...