STRINGS(1POSIX)
๐ STRINGS(1POSIX) ๐
okay bestie, welcome to the POSIX Programmer's Manual page for strings, from the IEEE/The Open Group era, no cap. this one's short and sweet and honestly kinda iconic.
๐ธ PROLOG ๐ธ
okay so first things first, this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ, so like... consult the corresponding Linux manual page for details on Linux behavior, mmkay? or the interface might just not be implemented on Linux at all. it's giving "read the fine print bestie". ๐
โจ NAME โจ
strings โ find printable strings in files ๐ฆ
๐ SYNOPSIS ๐
strings [-a] [-t format] [-n number] [file...]
๐ซ DESCRIPTION ๐ซ
so the strings utility shall look for printable strings in regular files and shall write those strings to standard output. periodt. ๐
a printable string is any sequence of four (by default) or more printable characters, terminated by a <newline> or NUL character. four characters minimum by default, bestie, remember that.
additional implementation-defined strings may be written; see localedef for the tea on that. ๐
ok but WARNING: if the first argument is -, the results are unspecified. unspecified means it's the wild west, bestie, do NOT count on it. ๐ญ
๐ OPTIONS ๐
the strings utility shall conform to the Base Definitions volume of POSIX.1โ2017, Section 12.2, Utility Syntax Guidelines, except for the unspecified usage of -. (yes the same - from before. it stays messy. ๐)
the following options shall be supported:
-aโ scan files in their entirety. and if-ais not specified? then it's implementation-defined what portion of each file is scanned for strings. so like, lowkey mysterious behavior. ๐-nnumber โ specify the minimum string length, where the number argument is a positive decimal integer. the default shall be4. โจ-tformat โ write each string preceded by its byte offset from the start of the file. the format shall be dependent on the single character used as the format option-argument:dโ the offset shall be written in decimal.oโ the offset shall be written in octal.xโ the offset shall be written in hexadecimal.
๐ซถ OPERANDS ๐ซถ
the following operand shall be supported:
fileโ a pathname of a regular file to be used as input. and if no file operand is specified, thestringsutility shall read from the standard input. no file? stdin it is, bestie. ๐
โญ STDIN โญ
see the INPUT FILES section. (it's right below. keep scrolling. i gotchu. ๐)
๐ธ INPUT FILES ๐ธ
the input files named by the utility arguments or the standard input shall be regular files of any format. any format!! it does not care. main character energy. ๐
๐ง ENVIRONMENT VARIABLES ๐ง
the following environment variables shall affect the execution of strings:
LANGโ provide a default value for the internationalization variables that are unset or null. (see the Base Definitions volume of POSIX.1โ2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) ๐LC_ALLโ if set to a non-empty string value, override the values of all the other internationalization variables. it overrides EVERYTHING. the boss. ๐LC_CTYPEโ determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files) and to identify printable strings. ๐คLC_MESSAGESโ determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. ๐ขNLSPATHโ determine the location of message catalogs for the processing ofLC_MESSAGES. ๐๏ธ
๐ ASYNCHRONOUS EVENTS ๐
default. that's it. that's the whole section. moving on. ๐ฆ
โจ STDOUT โจ
strings found shall be written to the standard output, one per line. ๐
when the -t option is not specified, the format of the output shall be:
"%s", <string>
with the -t o option, the format of the output shall be:
"%o %s", <byte offset>, <string>
with the -t x option, the format of the output shall be:
"%x %s", <byte offset>, <string>
with the -t d option, the format of the output shall be:
"%d %s", <byte offset>, <string>
look at all those formats, bestie. slay. ๐
๐ STDERR ๐
the standard error shall be used only for diagnostic messages. that's it. no drama there. ๐
๐ฆ OUTPUT FILES ๐ฆ
none. nothing. zero. the void. ๐
๐ EXTENDED DESCRIPTION ๐
none. same energy. โญ
๐ EXIT STATUS ๐
the following exit values shall be returned:
0โ successful completion. ๐>0โ an error occurred. ๐ญ
๐ CONSEQUENCES OF ERRORS ๐
default.
the following sections are informative. (iykyk โ informative means it's the lore, not the rules. ๐โจ)
๐ APPLICATION USAGE ๐
by default the data area (as opposed to the text, ``bss'', or header areas) of a binary executable file is scanned. implementations document which areas are scanned. ๐
some historical implementations do not require NUL or <newline> terminators for strings, to permit those languages that do not use NUL as a string terminator to have their strings written. history lesson, bestie. ๐ง
๐ EXAMPLES ๐
none. ๐ญ i know. tragic. no examples for us today.
๐ RATIONALE ๐
apart from rationalizing the option syntax and slight difficulties with object and executable binary files, strings is specified to match historical practice closely. the -a and -n options were introduced to replace the non-conforming - and -number options. these options are no longer specified by POSIX.1โ2008 but may be present in some implementations. โ ๏ธ
the -o option historically means different things on different implementations. some use it to mean offset in decimal'', while others use it as offset in octal''. instead of trying to decide which way would be least objectionable, the -t option was added. it was originally named -O to mean ``offset'', but was changed to -t to be consistent with od. character development honestly. ๐
the ISO C standard function is isprint(), and it's restricted to a domain of unsigned char. this volume of POSIX.1โ2017 requires implementations to write strings as defined by the current locale. ๐
๐ฎ FUTURE DIRECTIONS ๐ฎ
none. the future is... nothing? for this page at least. ๐
๐ธ SEE ALSO ๐ธ
localedefnm
the Base Definitions volume of POSIX.1โ2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
๐ COPYRIGHT ๐
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html . ๐ซถ
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . ๐
okay that's the whole page bestie, you made it to the end, iconic behavior honestly ๐โจ. this one came to you from IEEE/The Open Group, dated 2017, and it's the STRINGS(1POSIX) page. go forth and find your printable strings, my love. ๐๐๐ฆ๐ธ๐
๐ซถ
๐ฆ where this page comes from
- debian bookworm: manpages-posix 2017a-2 ยท Other
- debian trixie: manpages-posix 2017a-2 ยท Other
- ubuntu jammy: manpages-posix 2017a-2 ยท Other
- ubuntu noble: manpages-posix 2017a-2 ยท Other
- ubuntu resolute: manpages-posix 2017a-2build1 ยท Other
- ubuntu stonking: manpages-posix 2017a-2.1 ยท Other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms