{
    "mode": "man",
    "parameter": "truncate",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/truncate/1/json",
    "generated": "2026-05-30T05:14:55Z",
    "synopsis": "truncate OPTION... FILE...",
    "sections": {
        "NAME": {
            "content": "truncate - shrink or extend the size of a file to the specified size\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "truncate OPTION... FILE...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Shrink 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",
            "subsections": [
                {
                    "name": "-c --no-create",
                    "content": "do not create any files\n",
                    "flag": "-c",
                    "long": "--no-create"
                },
                {
                    "name": "-o --io-blocks",
                    "content": "treat SIZE as number of IO blocks instead of bytes\n",
                    "flag": "-o",
                    "long": "--io-blocks"
                },
                {
                    "name": "-r --reference",
                    "content": "base size on RFILE\n",
                    "flag": "-r",
                    "long": "--reference"
                },
                {
                    "name": "-s --size",
                    "content": "set or adjust the file size by SIZE bytes\n\n--help display this help and exit\n",
                    "flag": "-s",
                    "long": "--size"
                },
                {
                    "name": "--version",
                    "content": "output 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",
                    "long": "--version"
                }
            ]
        },
        "AUTHOR": {
            "content": "Written by Padraig Brady.\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": "dd(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)",
            "subsections": []
        }
    },
    "summary": "truncate - shrink or extend the size of a file to the specified size",
    "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"
        }
    ]
}