{
    "content": [
        {
            "type": "text",
            "text": "# truncate(1) (man)\n\n**Summary:** truncate - shrink or extend the size of a file to the specified size\n\n**Synopsis:** truncate OPTION... FILE...\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -c | --no-create | — | do not create any files |\n| -o | --io-blocks | — | treat SIZE as number of IO blocks instead of bytes |\n| -r | --reference | — | base size on RFILE |\n| -s | --size | — | set or adjust the file size by SIZE bytes --help display this help and exit |\n| — | --version | — | output version information and exit The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units a |\n\n## See Also\n\n- dd(1)\n- ftruncate(2)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (9 lines) — 5 subsections\n  - -c --no-create (2 lines)\n  - -o --io-blocks (2 lines)\n  - -r --reference (2 lines)\n  - -s --size (4 lines)\n  - --version (10 lines)\n- **AUTHOR** (2 lines)\n- **REPORTING BUGS** (3 lines)\n- **COPYRIGHT** (5 lines)\n- **SEE ALSO** (8 lines)\n\n## Full Content\n\n### NAME\n\ntruncate - shrink or extend the size of a file to the specified size\n\n### SYNOPSIS\n\ntruncate OPTION... FILE...\n\n### DESCRIPTION\n\nShrink or extend the size of each FILE to the specified size\n\nA FILE argument that does not exist is created.\n\nIf  a  FILE is larger than the specified size, the extra data is lost.  If a FILE is shorter,\nit is extended and the sparse extended part (hole) reads as zero bytes.\n\nMandatory arguments to long options are mandatory for short options too.\n\n#### -c --no-create\n\ndo not create any files\n\n#### -o --io-blocks\n\ntreat SIZE as number of IO blocks instead of bytes\n\n#### -r --reference\n\nbase size on RFILE\n\n#### -s --size\n\nset or adjust the file size by SIZE bytes\n\n--help display this help and exit\n\n#### --version\n\noutput version information and exit\n\nThe SIZE argument is an integer and optional unit  (example:  10K  is  10*1024).   Units  are\nK,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).  Binary prefixes can be used,\ntoo: KiB=K, MiB=M, and so on.\n\nSIZE may also be prefixed by one of the following modifying characters: '+'  extend  by,  '-'\nreduce by, '<' at most, '>' at least, '/' round down to multiple of, '%' round up to multiple\nof.\n\n### AUTHOR\n\nWritten by Padraig Brady.\n\n### REPORTING BUGS\n\nGNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n\n### COPYRIGHT\n\nCopyright © 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\n### SEE ALSO\n\ndd(1), truncate(2), ftruncate(2)\n\nFull documentation <https://www.gnu.org/software/coreutils/truncate>\nor available locally via: info '(coreutils) truncate invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                 TRUNCATE(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "truncate",
        "section": "1",
        "mode": "man",
        "summary": "truncate - shrink or extend the size of a file to the specified size",
        "synopsis": "truncate OPTION... FILE...",
        "flags": [
            {
                "flag": "-c",
                "long": "--no-create",
                "arg": null,
                "description": "do not create any files"
            },
            {
                "flag": "-o",
                "long": "--io-blocks",
                "arg": null,
                "description": "treat SIZE as number of IO blocks instead of bytes"
            },
            {
                "flag": "-r",
                "long": "--reference",
                "arg": null,
                "description": "base size on RFILE"
            },
            {
                "flag": "-s",
                "long": "--size",
                "arg": null,
                "description": "set or adjust the file size by SIZE bytes --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on. SIZE may also be prefixed by one of the following modifying characters: '+' extend by, '-' reduce by, '<' at most, '>' at least, '/' round down to multiple of, '%' round up to multiple of."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "dd",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/dd/1/json"
            },
            {
                "name": "ftruncate",
                "section": "2",
                "url": "https://www.chedong.com/phpMan.php/man/ftruncate/2/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": [
                    {
                        "name": "-c --no-create",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--no-create"
                    },
                    {
                        "name": "-o --io-blocks",
                        "lines": 2,
                        "flag": "-o",
                        "long": "--io-blocks"
                    },
                    {
                        "name": "-r --reference",
                        "lines": 2,
                        "flag": "-r",
                        "long": "--reference"
                    },
                    {
                        "name": "-s --size",
                        "lines": 4,
                        "flag": "-s",
                        "long": "--size"
                    },
                    {
                        "name": "--version",
                        "lines": 10,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ]
    }
}