STRINGS(1P)
π STRINGS(1P) β POSIX Programmer's Manual π
okay bestie, come sit with me, we're doing strings today and honestly? it's giving β¨forensicsβ¨. this one's from the POSIX Programmer's Manual, fr fr, and we're gonna go through the whole thing together. no skipping. i will know if you skip. π«Ά
πΈ PROLOG πΈ
okay so first things first, a little disclaimer the manual hits you with: 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 the details of Linux behavior, bestie), or the interface may literally not be implemented on Linux at all. π
π NAME π
strings β find printable strings in files π
β¨ SYNOPSIS β¨
strings [-a] [-t format] [-n number] [file...]
π¦ DESCRIPTION π¦
so what does it actually DO? the strings utility shall look for printable strings in regular files and shall write those strings to standard output. and what even IS a printable string, you ask? it's any sequence of four (by default) or more printable characters terminated by a <newline> or NUL character. four! by default! remember that number, it comes back. π
additional implementation-defined strings may be written β so like, more might show up, it's a vibe, check localedef for the deets.
β οΈ okay important: if the first argument is -, the results are unspecified. literally unspecified. nobody knows. chaos. π
π 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, that same weird - thing. we're all just living with it.)
the following options shall be supported:
-aβ scan files in their entirety, the whole thing, no crumbs left behind. if-ais not specified, it is implementation-defined what portion of each file is scanned for strings β so like, your mileage may vary, lowkey.-n numberβ specify the minimum string length, where the number argument is a positive decimal integer. the default shall be4. (told you it'd come back π)-t formatβ 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. if no file operand is specified, the
stringsutility shall read from the standard input. so it's flexible, she contains multitudes. π
π STDIN π
see the INPUT FILES section. (it's right below, bestie, we got you.)
π§ INPUT FILES π§
the input files named by the utility arguments or the standard input shall be regular files of any format. any format!! no judgment here, we love all formats equally. π«Ά
π 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. she's the boss. the main character. periodt.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. iconic minimalism. β¨
π₯ STDOUT π₯
strings found shall be written to the standard output, one per line. clean. organized. we love to see it.
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>
π STDERR π
the standard error shall be used only for diagnostic messages. that's it. don't put your vibes there. π
π OUTPUT FILES π
none. nothing. empty. she simply does not write files. slay.
π¦ EXTENDED DESCRIPTION π¦
none. (another iconic minimalist moment, we stan a short section β¨)
β 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.
π 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. so like, the manual says it, and your implementation says it, and together we figure it out. teamwork. π«Ά
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. (letting the old-school languages have their moment π
)
π EXAMPLES π
none. (ngl, would've loved one, but the manual said no. respect. π)
π RATIONALE π
okay this is the tea section, get comfortable. β
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. so like... legacy behavior, iykyk. π
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. the lore!!! the character development!!! π
the ISO C standard function isprint() is 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... unspecified. very on brand. β¨
π 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 .
and that's the whole page bestie, every last flag and footnote, we read it together like the icons we are. π β¨
this has been a presentation of IEEE/The Open Group, 2017, STRINGS(1P) β mwah, take care of yourselves, drink water, and go find some strings. ππ¦π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms