how to delete a directory ubuntu code example Example 1: ubuntu remove directory rm -R folder-name Example 2: remove folder ubuntu sudo rm -rf folder-name