Copied to clipboard

rm

The rm command is used to delete files or directories

Example

  • rm file.txt, delete the file named file.txt.
  • rm -r directory, delete the directory named directory and its contents.
  • rm -i file.txt, delete the file named file.txt, but prompt for confirmation before deleting.
  • rm -f file.txt, forcefully delete the file named file.txt without prompting for confirmation.
  • rm -rf directory, forcefully and recursively delete the directory named directory and its contents without prompting for confirmation.