{
    "mode": "info",
    "parameter": "truncate",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/truncate/json",
    "generated": "2026-10-13T06:53:39Z",
    "sections": {
        "File: coreutils.info,  Node: truncate invocation,  Prev: sync invocation,  Up: File space usage": {
            "content": "",
            "subsections": [
                {
                    "name": "14.5 'truncate': Shrink or extend the size of a file",
                    "content": "'truncate' shrinks or extends the size of each FILE to the specified\nsize.  Synopsis:\n\ntruncate OPTION... FILE...\n\nAny FILE 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, it is extended and the sparse extended part (or": {
            "content": "hole) reads as zero bytes.\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'-c'\n'--no-create'\nDo not create files that do not exist.\n\n'-o'\n'--io-blocks'\nTreat SIZE as number of I/O blocks of the FILE rather than bytes.\n\n'-r RFILE'\n'--reference=RFILE'\nBase the size of each FILE on the size of RFILE.\n\n'-s SIZE'\n'--size=SIZE'\nSet or adjust the size of each FILE according to SIZE.  SIZE is in\nbytes unless '--io-blocks' is specified.  SIZE may be, or may be an\ninteger optionally followed by, one of the following multiplicative\nsuffixes:\n'KB' =>           1000 (KiloBytes)\n'K'  =>           1024 (KibiBytes)\n'MB' =>      1000*1000 (MegaBytes)\n'M'  =>      1024*1024 (MebiBytes)\n'GB' => 1000*1000*1000 (GigaBytes)\n'G'  => 1024*1024*1024 (GibiBytes)\nand so on for 'T', 'P', 'E', 'Z', 'Y', 'R', and 'Q'.  Binary\nprefixes can be used, too: 'KiB'='K', 'MiB'='M', and so on.\n\nSIZE may also be prefixed by one of the following to adjust the\nsize of each FILE based on its current size:\n'+'  => extend by\n'-'  => reduce by\n'<'  => at most\n'>'  => at least\n'/'  => round down to multiple of\n'%'  => round up to multiple of\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}