how to delete the directory folder in linux code example Example 1: delete directory linux rm -rf dir1 Example 2: remove directory linux rm -rf /path/to/directory/*