{
    "mode": "man",
    "parameter": "rm",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/rm/json",
    "generated": "2026-06-15T14:15:57Z",
    "synopsis": "rm [OPTION]... [FILE]...",
    "sections": {
        "NAME": {
            "content": "rm - remove files or directories\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "rm [OPTION]... [FILE]...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This  manual  page  documents the GNU version of rm.  rm removes each specified file.  By de‐\nfault, it does not remove directories.\n\nIf the -I or --interactive=once option is given, and there are more than three files  or  the\n-r,  -R,  or  --recursive are given, then rm prompts the user for whether to proceed with the\nentire operation.  If the response is not affirmative, the entire command is aborted.\n\nOtherwise, if a file is unwritable, standard input is a terminal, and the -f or  --force  op‐\ntion is not given, or the -i or --interactive=always option is given, rm prompts the user for\nwhether to remove the file.  If the response is not affirmative, the file is skipped.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Remove (unlink) the FILE(s).\n",
            "subsections": [
                {
                    "name": "-f --force",
                    "content": "ignore nonexistent files and arguments, never prompt\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "-i",
                    "content": "",
                    "flag": "-i"
                },
                {
                    "name": "-I",
                    "content": "intrusive than -i, while still giving protection against most mistakes\n\n--interactive[=WHEN]\nprompt  according  to WHEN: never, once (-I), or always (-i); without WHEN, prompt al‐\nways\n",
                    "flag": "-I"
                },
                {
                    "name": "--one-file-system",
                    "content": "when removing a hierarchy recursively, skip any directory that is  on  a  file  system\ndifferent from that of the corresponding command line argument\n",
                    "long": "--one-file-system"
                },
                {
                    "name": "--no-preserve-root",
                    "content": "do not treat '/' specially\n\n--preserve-root[=all]\ndo  not  remove '/' (default); with 'all', reject any command line argument on a sepa‐\nrate device from its parent\n",
                    "long": "--no-preserve-root"
                },
                {
                    "name": "-r -R --recursive",
                    "content": "remove directories and their contents recursively\n",
                    "flag": "-R",
                    "long": "--recursive"
                },
                {
                    "name": "-d --dir",
                    "content": "remove empty directories\n",
                    "flag": "-d",
                    "long": "--dir"
                },
                {
                    "name": "-v --verbose",
                    "content": "explain what is being done\n\n--help display this help and exit\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "--version",
                    "content": "output version information and exit\n\nBy default, rm does not remove directories.  Use the --recursive (-r or -R) option to  remove\neach listed directory, too, along with all of its contents.\n\nTo remove a file whose name starts with a '-', for example '-foo', use one of these commands:\n\nrm -- -foo\n\nrm ./-foo\n\nNote  that  if  you use rm to remove a file, it might be possible to recover some of its con‐\ntents, given sufficient expertise and/or time.  For greater assurance that the  contents  are\ntruly unrecoverable, consider using shred.\n",
                    "long": "--version"
                }
            ]
        },
        "AUTHOR": {
            "content": "Written by Paul Rubin, David MacKenzie, Richard M. Stallman, and Jim Meyering.\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright  ©  2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later\n<https://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.  There is NO WARRANTY,  to\nthe extent permitted by law.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "unlink(1), unlink(2), chattr(1), shred(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/rm>\nor available locally via: info '(coreutils) rm invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                       RM(1)",
            "subsections": []
        }
    },
    "summary": "rm - remove files or directories",
    "flags": [
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "ignore nonexistent files and arguments, never prompt"
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-I",
            "long": null,
            "arg": null,
            "description": "intrusive than -i, while still giving protection against most mistakes --interactive[=WHEN] prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt al‐ ways"
        },
        {
            "flag": "",
            "long": "--one-file-system",
            "arg": null,
            "description": "when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument"
        },
        {
            "flag": "",
            "long": "--no-preserve-root",
            "arg": null,
            "description": "do not treat '/' specially --preserve-root[=all] do not remove '/' (default); with 'all', reject any command line argument on a sepa‐ rate device from its parent"
        },
        {
            "flag": "-R",
            "long": "--recursive",
            "arg": null,
            "description": "remove directories and their contents recursively"
        },
        {
            "flag": "-d",
            "long": "--dir",
            "arg": null,
            "description": "remove empty directories"
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "explain what is being done --help display this help and exit"
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "output version information and exit By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents. To remove a file whose name starts with a '-', for example '-foo', use one of these commands: rm -- -foo rm ./-foo Note that if you use rm to remove a file, it might be possible to recover some of its con‐ tents, given sufficient expertise and/or time. For greater assurance that the contents are truly unrecoverable, consider using shred."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "unlink",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/unlink/1/json"
        },
        {
            "name": "unlink",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/unlink/2/json"
        },
        {
            "name": "chattr",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chattr/1/json"
        },
        {
            "name": "shred",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/shred/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Remove files or directories.",
        "examples": [
            {
                "description": "Remove specific files",
                "command": "rm {{path/to/file1 path/to/file2 ...}}"
            },
            {
                "description": "Remove specific files ignoring nonexistent ones",
                "command": "rm {{-f|--force}} {{path/to/file1 path/to/file2 ...}}"
            },
            {
                "description": "Remove specific files interactively prompting before each removal",
                "command": "rm {{-i|--interactive}} {{path/to/file1 path/to/file2 ...}}"
            },
            {
                "description": "Remove specific files printing info about each removal",
                "command": "rm {{-v|--verbose}} {{path/to/file1 path/to/file2 ...}}"
            },
            {
                "description": "Remove specific files and directories recursively",
                "command": "rm {{-r|--recursive}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}"
            },
            {
                "description": "Remove empty directories (this is considered the safe method)",
                "command": "rm {{-d|--dir}} {{path/to/directory}}"
            }
        ]
    }
}