Close Menu
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • How to
      • Q&A
    • OS
      • Windows
      • Arch Linux
    • AI
    • Gaming
      • Easter Eggs
    • Statistics
    • Blog
      • Featured
    • MORE
      • IP Address
      • Man Pages
    • Write For Us
    • Contact
    Command Linux
    Home - man page - STRSTR

    STRSTR

    WillieBy WillieFebruary 3, 2026Updated:February 3, 2026No Comments1 Min Read

    NAME

    strstr, strcasestr – locate a substring  

    SYNOPSIS

    #include <string.h>
    
    char *strstr(const char *haystack, const char *needle);
    
    #define _GNU_SOURCE         /* See feature_test_macros(7) */
    
    #include <string.h>
    
    char *strcasestr(const char *haystack, const char *needle);
    
     

    DESCRIPTION

    The strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating null bytes (‘\0’) are not compared.

    The strcasestr() function is like strstr(), but ignores the case of both arguments.  

    RETURN VALUE

    These functions return a pointer to the beginning of the located substring, or NULL if the substring is not found.  

    ATTRIBUTES

     

    Multithreading (see pthreads(7))

    The strstr() function is thread-safe.

    The strcasestr() function is thread-safe with exceptions. It can be safely used in multithreaded applications, as long as setlocale(3) is not called to change the locale during its execution.  

    CONFORMING TO

    The strstr() function conforms to C89 and C99. The strcasestr() function is a nonstandard extension.

    COLOPHON

    This page is part of release 3.74 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at http://www.kernel.org/doc/man-pages/.

    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    NTFS-3G

    April 21, 2026

    CAT

    April 21, 2026

    RPCBIND

    April 21, 2026

    SYSCTL

    April 21, 2026
    Top Posts

    Top Linux Desktop Environments In 2026

    January 8, 2026

    RENICE

    April 17, 2026

    SCP

    April 16, 2026

    How to Use WinSCP for Linux File Transfers

    March 30, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.