Sobes.tech
Junior

What actions does the 'rm' command perform in the operating system?

sobes.tech AI

Answer from AI

rm (from remove) in the operating system is used to delete files and directories.

Main options:

  • -f: force deletion, does not ask for confirmation.
  • -i: prompts for confirmation before deleting each file.
  • -r or -R: recursive deletion, used for deleting directories and their contents.
  • -v: displays information about which files are being deleted.

Usage examples:

  • Delete the file test.txt:
    rm test.txt
    
  • Delete the directory my_folder and all its contents:
    rm -r my_folder
    
  • Force delete a file without confirmation:
    rm -f another_file.log