LinuxCommandLibrary

avahi-browse

Discover services available on the local network

TLDR

List services available on the local network along with their addresses and ports, ignoring ones on the local machine

$ avahi-browse [[-a|--all]] [[-r|--resolve]] [[-l|--ignore-local]]
copy

Quickly list services in the local network in SSV format for scripts
$ avahi-browse [[-a|--all]] [[-t|--terminate]] [[-p|--parsable]]
copy

List domains in the neighbourhood
$ avahi-browse [[-D|--browse-domains]]
copy

Limit the search to a particular domain
$ avahi-browse [[-a|--all]] --domain=[domain]
copy

SYNOPSIS

avahi-browse [OPTION...] [TYPE|DOMAIN]

Example usage:
avbr -a
avahi-browse -r _ipp._tcp
avahi-browse --all --resolve --terminate

PARAMETERS

-a
    Show all service types and browsing domains.

--all
    Equivalent to -a.

-r
    Resolve discovered services to their hostnames and IP addresses.

--resolve
    Equivalent to -r.

-t
    Terminate the program after the initial listing of services.

--terminate
    Equivalent to -t.

-s
    Show only services (default behavior if no type/domain is specified).

--services
    Equivalent to -s.

-d
    Show only browsing domains.

--domains
    Equivalent to -d.

-b
    Browse for available browsing domains themselves.

--browse-domains
    Equivalent to -b.

-v
    Enable verbose output, providing more detailed information.

--verbose
    Equivalent to -v.

-c
    Only show entries that are already in the Avahi daemon's cache.

--cache
    Equivalent to -c.

-l
    List all available service types currently known to the daemon.

--list-all
    Equivalent to -l.

-p <PROTOCOL>
    Specify the IP protocol to use (e.g., 'ipv4' or 'ipv6').

--protocol=<PROTOCOL>
    Equivalent to -p.

-f <FILTER>
    Filter displayed services by a given string.

--filter=<FILTER>
    Equivalent to -f.

-V
    Display the Avahi version information and exit.

--version
    Equivalent to -V.

-h
    Display a help message and exit.

--help
    Equivalent to -h.

DESCRIPTION

Avahi is a free implementation of Zeroconf, including mDNS (multicast DNS) and DNS-SD (DNS Service Discovery). avahi-browse is a command-line utility provided by the Avahi project, designed to discover services advertised on a local network using these protocols. It allows users to quickly find available resources like network printers, file shares (e.g., AFP, SMB), remote desktop services (VNC, RDP), and other applications that publish their presence via Zeroconf. The command queries the local network for advertised service types and instances, presenting them in a human-readable format. This is particularly useful in environments where manual IP address configuration or hostname lookup is inconvenient or impossible, enabling automatic, zero-configuration networking.

CAVEATS

  • Requires the Avahi daemon (avahi-daemon) to be running in the background for service discovery to function.
  • Firewall rules might prevent mDNS (UDP port 5353) traffic, hindering service discovery.
  • Services must explicitly advertise themselves using DNS-SD for avahi-browse to find them.
  • The --terminate option is crucial for scripting, as avahi-browse runs continuously by default, monitoring for new services.

<I>SERVICE TYPES</I>

Services are identified by a type string, typically in the format _service._protocol. Examples include _ipp._tcp for IPP printers, _smb._tcp for Samba shares, or _vnc._tcp for VNC servers. Using avahi-browse -t or avahi-browse -a will reveal various service types present on your network.

<I>CONTINUOUS MONITORING</I>

By default, avahi-browse runs continuously, listening for new services or changes to existing ones. This is useful for real-time monitoring. To get a snapshot and exit, use the --terminate option.

<I>RESOLVING SERVICES</I>

When a service is found, avahi-browse typically shows its name and type. To get the associated IP address and port, which are often necessary for connecting, use the --resolve option.

HISTORY

Avahi was initiated in 2004 by Lennart Poettering and Trent Lloyd as a free software implementation of Apple's Bonjour (formerly Rendezvous) Zeroconf technologies. avahi-browse emerged as a fundamental utility within the Avahi suite, providing a standard way for Linux and Unix-like systems to discover services on local networks without manual configuration. It became widely adopted in many distributions, integrating seamless network discovery into desktop environments and server applications, significantly simplifying device and service interaction.

SEE ALSO

avahi-daemon(8), avahi-publish(1), avahi-resolve(1), dns-sd(1), nmap(1)

Copied to clipboard