ls_net

Crates.iols_net
lib.rsls_net
version0.1.2
created_at2025-05-26 13:20:11.933025+00
updated_at2025-06-04 12:23:23.635454+00
descriptionA CLI tool for displaying local network interfaces, IP addresses and routes.
homepage
repositoryhttps://github.com/guangyu-he/ls_net
max_upload_size
id1689646
size38,621
Guangyu He (guangyu-he)

documentation

README

ls_net

A CLI tool for displaying local network interfaces, IP addresses, and routing tables. Built in Rust, ls_net provides a cross-platform way to inspect your machine's network configuration with simple commands.

Features

  • List all network interfaces and their IP addresses
  • Show the main IP address of the machine
  • Display the system's routing table and default gateway
  • Filter interfaces by protocol: IPv4, IPv6, or both
  • Colorized output for readability

Installation

from source

  1. Clone the repository:

    git clone https://github.com/guangyu-he/ls_net
    cd ls_net
    
  2. Build or install with Cargo:

    cargo build --release
    

    or

    cargo install --path .
    

from git

cargo install --git https://github.com/guangyu-he/ls_net

from crates.io

cargo install ls_net

Usage

ls_net [OPTIONS]

Options

  • -p, --protocol <PROTOCOL> Protocol type to use: all, ipv4, or ipv6. Defaults to ipv4.
  • -h, --help Print help information
  • -V, --version Print version information

Example

minimal usage

ls_net

for all protocols

ls_net -p all

Output Example (on MacOS)

Local Network Interfaces and IP Addresses
Main IP address: 192.168.1.100
============================================
eth0      : 192.168.1.100
lo        : 127.0.0.1
...
============================================
Found x network interfaces (displaying x)

================ IPv4 Routes ================
Destination        Gateway             Flags      Netif    Expire
0.0.0.0            192.168.1.1         UGSC       0.0.0.0     
...
================ IPv4 Default Gateway ================
IPv4 Default Gateway: 192.168.1.1 via en0

Platform Support

  • macOS and Linux: Uses netstat -nr for route table
  • Windows: Uses route print

Dependencies

License

MIT

Commit count: 13

cargo fmt