PRINTF(1)
๐ PRINTF(1) โ the User Commands era โจ
okay so bestie, welcome to printf(1) โ literally one of the User Commands girlies, living in the GNU coreutils house ๐ ๐. She formats and prints data, she's been doing it since forever, and she ate. No cap.
๐ธ NAME ๐ธ
printf โ format and print data, periodt ๐ซ
๐ SYNOPSIS ๐
printf FORMAT [ARGUMENT]...
printf OPTION
โจ DESCRIPTION โจ
So basically: you print your ARGUMENT(s) according to FORMAT ๐ , OR you just execute according to OPTION like a lazy queen ๐:
--helpโ display this help and exit ๐ซถ--versionโ output version information and exit ๐
FORMAT controls the output, exactly like in C printf. The interpreted sequences are (memorize these, fr fr ๐ญ):
\"โ double quote\\โ backslash\aโ alert (bell) ๐\bโ backspace\cโ produce no further output ๐ (she's done talking)\eโ escape\fโ form feed\nโ new line\rโ carriage return\tโ horizontal tab\vโ vertical tab\NNNโ byte with octal value NNN (1 to 3 digits)\xHHโ byte with hexadecimal value HH (1 to 2 digits)\uHHHHโ Unicode (ISO/IEC 10646) character with hex value HHHH (4 digits)\UHHHHHHHHโ Unicode character with hex value HHHHHHHH (8 digits)
and also:
%%โ a single%%bโ ARGUMENT as a string with'\'escapes interpreted, except that octal escapes should have a leading0like\0NNN%qโ ARGUMENT is printed in a format that can be reused as shell input, escaping non-printable characters with the POSIX$''syntax
plus all the C printf(3) format specifications ending with one of diouxXfaAeEgGcs, with ARGUMENTs converted to proper type first ๐. FORMAT is reused to convert all specified arguments โ she doesn't get tired, she just loops ๐. The table below shows the supported conversion specifiers, with examples including usage of width, precision, and flags:
%sโ shell format example'[%10s]' 'left pad'โ output[ left pad]%sโ shell format example'[%-10s]' 'right pad'โ output[right pad ]%c%sโ shell format example'%c %.3s' un unibyteโ outputu uni%d%iโ shell format example"%'d ;%04i" 1234 '-1'โ output1,234 ;-001%oโ shell format example'%#o' $((2#110100100))โ output0644%uโ shell format example'%u' 0xFFFFFFFFโ output4294967295%xโ shell format example'0x%08x' 11259375โ output0x00abcdef%a%fโ shell format example'%1$a %1$f' 0.0009765625โ output0x8p-13 0.000977%e%fโ shell format example'%1$e %1$f' 123.456789โ output1.234568e+02 123.456789%gโ shell format example'%1$g %1$.2g' 1.2345678e3โ output1234.57 1.2e+03%bโ shell format example'%bfoo' 'bar\cbaz' quxโ outputbar%qโ shell format example'%q ' 'a' \;b $'c\n'โ outputa ';b' 'c'$'\n'
๐จ bestie heads up: your shell may have its own version of printf, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports. iykyk ๐
๐ AUTHOR ๐
Written by David MacKenzie. (iconic behavior, we stan ๐ซถ)
๐ REPORTING BUGS ๐
- Report bugs to: <bug-coreutils@gnu.org>.
- Report any translation bugs to: <https://translationproject.org/team/>.
- GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
- General help using GNU software: <https://www.gnu.org/gethelp/>
๐ COPYRIGHT ๐
Copyright ยฉ 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. (so like, she's free, but she's not gonna hold your hand, bestie ๐ญ)
๐ SEE ALSO ๐
Full documentation <https://www.gnu.org/software/coreutils/printf> or available locally via: info '(coreutils) printf invocation'
and that's the whole page, diva ๐ โจ this was GNU coreutils 9.12, dated September 2026, and yes she's giving User Commands main character energy the entire time ๐ธ๐ฆ โ now go format something, bestie, you got this fr fr ๐
๐ฆ where this page comes from
- arch rolling: coreutils 9.12-2 ยท GPL-3.0-or-later AND GFDL-1.3-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms