Terminal Icon

Removing a file or directory

To remove a file, use the rm command.

For example, to delete myfile1 and its contents, enter:

rm myfile1

You can delete multiple files by giving the command a list of the remaining files to be deleted.

You will see a confirmation prompt asking if you want to delete the file.

rm can also remove an empty directory. To remove a full directory you must include the -r option.

For example, to delete the full directory "directoryname," enter:

rm -r directoryname

For more information on removing files, refer to the rm man page by entering: man rm

See also

UNIX

Open this for me

man page for rm