{
    "mode": "man",
    "parameter": "unexpand",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/unexpand/1/json",
    "generated": "2026-07-05T13:26:00Z",
    "synopsis": "unexpand [OPTION]... [FILE]...",
    "sections": {
        "NAME": {
            "content": "unexpand - convert spaces to tabs\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "unexpand [OPTION]... [FILE]...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Convert blanks in each FILE to tabs, writing to standard output.\n\nWith no FILE, or when FILE is -, read standard input.\n\nMandatory arguments to long options are mandatory for short options too.\n",
            "subsections": [
                {
                    "name": "-a --all",
                    "content": "convert all blanks, instead of just initial blanks\n",
                    "flag": "-a",
                    "long": "--all"
                },
                {
                    "name": "--first-only",
                    "content": "convert only leading sequences of blanks (overrides -a)\n",
                    "long": "--first-only"
                },
                {
                    "name": "-t --tabs",
                    "content": "have tabs N characters apart instead of 8 (enables -a)\n",
                    "flag": "-t",
                    "long": "--tabs"
                },
                {
                    "name": "-t --tabs",
                    "content": "use  comma separated list of tab positions The last specified position can be prefixed\nwith '/' to specify a tab size to use after the last explicitly  specified  tab  stop.\nAlso  a  prefix  of  '+' can be used to align remaining tab stops relative to the last\nspecified tab stop instead of the first column\n\n--help display this help and exit\n",
                    "flag": "-t",
                    "long": "--tabs"
                },
                {
                    "name": "--version",
                    "content": "output version information and exit\n",
                    "long": "--version"
                }
            ]
        },
        "AUTHOR": {
            "content": "Written by David MacKenzie.\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": "expand(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/unexpand>\nor available locally via: info '(coreutils) unexpand invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                 UNEXPAND(1)",
            "subsections": []
        }
    },
    "summary": "unexpand - convert spaces to tabs",
    "flags": [
        {
            "flag": "-a",
            "long": "--all",
            "arg": null,
            "description": "convert all blanks, instead of just initial blanks"
        },
        {
            "flag": "",
            "long": "--first-only",
            "arg": null,
            "description": "convert only leading sequences of blanks (overrides -a)"
        },
        {
            "flag": "-t",
            "long": "--tabs",
            "arg": null,
            "description": "have tabs N characters apart instead of 8 (enables -a)"
        },
        {
            "flag": "-t",
            "long": "--tabs",
            "arg": null,
            "description": "use comma separated list of tab positions The last specified position can be prefixed with '/' to specify a tab size to use after the last explicitly specified tab stop. Also a prefix of '+' can be used to align remaining tab stops relative to the last specified tab stop instead of the first column --help display this help and exit"
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "output version information and exit"
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "expand",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/expand/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert spaces to tabs.",
        "examples": [
            {
                "description": "Convert blanks in each file to tabs, writing to `stdout`",
                "command": "unexpand {{path/to/file}}"
            },
            {
                "description": "Convert blanks to tabs, reading from `stdout`",
                "command": "unexpand"
            },
            {
                "description": "Convert all blanks, instead of just initial blanks",
                "command": "unexpand {{-a|--all}} {{path/to/file}}"
            },
            {
                "description": "Convert only leading sequences of blanks (overrides -a)",
                "command": "unexpand --first-only {{path/to/file}}"
            },
            {
                "description": "Have tabs a certain number of characters apart, not 8 (enables -a)",
                "command": "unexpand {{-t|--tabs}} {{number}} {{path/to/file}}"
            }
        ]
    }
}