Easy Tutorial
❮ Linux Comm Reset Linux Comm Umount ❯

Linux indent Command

Linux Command Manual

The Linux indent command is used to adjust the formatting of C source code files.

indent can recognize C source code files and format them to facilitate reading by programmers.

Syntax

indent [options][source file] or indent [options][source file][-o target file]

Options:

Indent Code Formatting Instructions

Used indent parameter Value Meaning
--blank-lines-after-declarations bad Add a blank line after variable declarations
--blank-lines-after-procedures bap Add a blank line after functions
--blank-lines-before-block-comments bbb Add a blank line before block comments
--break-before-boolean-operator bbo Break long lines before logical operators
--blank-lines-after-commas nbc Do not break lines in variable declarations separated by commas
--braces-after-if-line bl Place "if" and "{" on separate lines
--brace-indent 0 bli0 "{" does not continue to indent
--braces-after-struct-decl-line bls Place "struct" and "{" on separate lines in structure definitions
--comment-indentationn c33 Comments after statements start at column 33
--declaration-comment-columnn cd33 Comments after variable declarations start at column 33
--comment-delimiters-on-blank-lines ncdb Do not turn single-line comments into block comments
--cuddle-do-while ncdw Place "while" of "do --- while" and the preceding "}" on a new line
--cuddle-else nce Place "else" and the preceding "}" on a new line
--case-indentation 0 cli0 Indent case statements in switch by 0 spaces
--else-endif-columnn cp33 Comments after #else, #endif start at column 33
--space-after-cast cs Add a space after type casting
--line-comments-indentation n d0 Single-line comments (not starting from column 1) do not indent to the left
--break-function-decl-args nbfda Disable: Function arguments on one line each
--declaration-indentationn di2 Variable declarations start at line 2, i.e., do not align
--format-first-column-comments nfc1 Do not format comments starting from the first line
--format-all-comments nfca Do not enable the switch for formatting all comments
--honour-newlines hnl Prefer to break long lines at the position of newlines in the input
--indent-leveln i4 Set the number of characters to indent; if a multiple of the tab size, use tabs; otherwise, use spaces
--parameter-indentationn ip5 Indent parameter descriptions in old-style function definitions by 5 spaces
--line-length 75 l75 Maximum line length for non-comment lines is 75
--continue-at-parentheses lp Continuation lines start at the parentheses from the previous line
--space-after-procedure-calls pcs Insert a space between the function and "("
--space-after-parentheses nprs Do not insert a space after "(" and before ")"
--procnames-start-lines psl Place function names and return types on separate lines
--space-after-for saf Include a space after "for"
--space-after-if sai Include a space after "if"
--space-after-while saw Include a space after "while"
--start-left-side-of-comments nsc Do not add "*" at the start of generated block comments
--swallow-optional-blank-lines nsob Do not remove optional blank lines
--space-special-semicolon nss Do not add a space before ";" in single-line for or while statements
--tab-size ts4 One tab equals 4 spaces (must be divisible by "-in")
--use-tabs ut Use tabs for indentation

Linux Command Manual

❮ Linux Comm Reset Linux Comm Umount ❯