You need to use the rm command line utility to remove the files (and directories) specified on the command line. The following command will delete everything including subdires and file from the $HOME/foo directory. So be careful. You will not able to recover files or sub-dirs from the $HOME/foo directory. You have been warned. In order to delete directories, it is necessary to use the -r or -R option. This option recursively removes directories and their contents in the argument list passed to the rm command. The user is normally prompted for removal of any write-protected files in the directories unless the -f option is used by the end user. The syntax is as follows:
rm -rf /path/to/dir rm -rf $HOME/foo/ rm -rfi $HOME/foo/
- -r or -R : Attempt to remove the file hierarchy rooted in $HOME/foo/ i.e. delete all directory's contents including all files and sub-dirs.
- -f : Attempt to remove the files without prompting for confirmation, regardless of the file's permissions.
- -i : Request confirmation before attempting to remove each file, regardless of the file's permissions
For more information, see the rm command man page by typing the following command:
$ man rm