RM(1) General Commands Manual RM(1)

rmremove files and directories

rm [-dfirRv] [file...]

The rm utility removes each given file, by default directories aren't removed.

As required by POSIX, rm explicitly checks if a file is writable, when not and -f wasn't passed, the user is prompted before removal. Care should be taken when using other programs as unlink(2) only fails when the containing directory isn't writable, rather than the file itself.

Remove empty directories, doesn't empties them first via recursion.
Force: Never prompt before recursing into directories and removing files, non-existing files do not change exit status nor produce diagnostic messages. Overrides -i.
Interactive: Prompt before removing any file
, -R
Recurse into directories, also allowing to remove them.
Verbose: Print when a file got removed

The rm utility exits 0 on success, and >0 if an error occurs.

unlink(2)

rm should be compliant with the IEEE Std 1003.1-2024 (“POSIX.1”) specification.

Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>

2024-03-20 Linux 6.6.67-gentoo-x86_64