To delete a file or directory in terminal (command line) use the rm command.
Here is how to delete an entire directory:
rm -dfr directory
OPTIONS
-d, –directory
unlink FILE, even if it is a non-empty directory (super-user only)
-f, –force
ignore nonexistent files, never prompt
-i, –interactive
prompt before any removal
-r, -R, –recursive
remove the contents of directories recursively
-v, –verbose
explain what is being done
–help
display this help and exit
–version
output version information and exit
To remove a file whose name starts with a ‘-‘, for example `-foo’, use one of these commands:
rm -- -foo
rm ./-foo
To remove a file whose name contains a ‘*’ (or other special character), you will need to escape it. For example, I wanted to delete all directories starting with ‘~*w’:
rm -dfr ~\*w*