STRINGS(1)                 POSIX Programmer's Manual                STRINGS(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       strings -- find printable strings in files

SSYYNNOOPPSSIISS
       strings [[-a]] [[-t _f_o_r_m_a_t]] [[-n _n_u_m_b_e_r]] [[_f_i_l_e...]]

DDEESSCCRRIIPPTTIIOONN
       The _s_t_r_i_n_g_s utility shall look for printable strings in regular files
       and shall write those strings to standard output. A printable string is
       any sequence of four (by default) or more printable characters
       terminated by a <newline> or NUL character. Additional implementation-
       defined strings may be written; see _l_o_c_a_l_e_d_e_f.

       If the first argument is ''--'', the results are unspecified.

OOPPTTIIOONNSS
       The _s_t_r_i_n_g_s utility shall conform to the Base Definitions volume of
       POSIX.1-2008, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, except for the
       unspecified usage of ''--''.

       The following options shall be supported:

       --aa        Scan files in their entirety. If --aa is not specified, it is
                 implementation-defined what portion of each file is scanned
                 for strings.

       --nn _n_u_m_b_e_r Specify the minimum string length, where the _n_u_m_b_e_r argument
                 is a positive decimal integer. The default shall be 4.

       --tt _f_o_r_m_a_t 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 _f_o_r_m_a_t 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.

OOPPEERRAANNDDSS
       The following operand shall be supported:

       _f_i_l_e      A pathname of a regular file to be used as input. If no _f_i_l_e
                 operand is specified, the _s_t_r_i_n_g_s utility shall read from the
                 standard input.

SSTTDDIINN
       See the INPUT FILES section.

IINNPPUUTT FFIILLEESS
       The input files named by the utility arguments or the standard input
       shall be regular files of any format.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of
       _s_t_r_i_n_g_s:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2008, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  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.

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       Strings found shall be written to the standard output, one per line.

       When the --tt option is not specified, the format of the output shall be:

           ""%%ss"",, <<_s_t_r_i_n_g>

       With the --tt oo option, the format of the output shall be:

           ""%%oo %%ss"",, <<_b_y_t_e _o_f_f_s_e_t>, <_s_t_r_i_n_g>

       With the --tt xx option, the format of the output shall be:

           ""%%xx %%ss"",, <<_b_y_t_e _o_f_f_s_e_t>, <_s_t_r_i_n_g>

       With the --tt dd option, the format of the output shall be:

           ""%%dd %%ss"",, <<_b_y_t_e _o_f_f_s_e_t>, <_s_t_r_i_n_g>

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       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.

EEXXAAMMPPLLEESS
       None.

RRAATTIIOONNAALLEE
       Apart from rationalizing the option syntax and slight difficulties with
       object and executable binary files, _s_t_r_i_n_g_s is specified to match
       historical practice closely. The --aa and --nn options were introduced to
       replace the non-conforming -- and --_n_u_m_b_e_r options. These options are no
       longer specified by POSIX.1-2008 but may be present in some
       implementations.

       The --oo option historically means different things on different
       implementations. Some use it to mean ``_o_f_f_s_e_t in decimal'', while
       others use it as ``_o_f_f_s_e_t in octal''. Instead of trying to decide which
       way would be least objectionable, the --tt option was added. It was
       originally named --OO to mean ``offset'', but was changed to --tt to be
       consistent with _o_d.

       The ISO C standard function _i_s_p_r_i_n_t() is restricted to a domain of
       uunnssiiggnneedd cchhaarr.  This volume of POSIX.1-2008 requires implementations to
       write strings as defined by the current locale.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _l_o_c_a_l_e_d_e_f, _n_m

       The Base Definitions volume of POSIX.1-2008, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/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 .



IEEE/The Open Group                  2013                           STRINGS(1)
