remove folder linux terminal code example

Example 1: ubuntu remove directory

rm -R folder-name

Example 2: delete file linux terminal

rm filename
# or add -rf if you don't want to see confirm

Example 3: remove directory linux

rm -rf /path/to/directory/*

Example 4: terminal delete fle

rm MyFile.rtf

Example 5: how to remove folder from linux terminal

To remove an empty directory, use the rmdir command as follows:
$ rmdir foldername

If the directory still contains files or subdirectories, the rmdir command does not remove the directory.
To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r.

$ rm -r foldername

Tags:

Misc Example