LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ifdata

retrieves network interface information in a script-friendly format

TLDR

Get IP address
$ ifdata -pa [eth0]
copy
Get netmask
$ ifdata -pn [eth0]
copy
Get broadcast address
$ ifdata -pb [eth0]
copy
Get MAC address
$ ifdata -ph [eth0]
copy
Get MTU
$ ifdata -pm [eth0]
copy
Check if interface exists
$ ifdata -e [eth0]
copy
Get network address
$ ifdata -pN [eth0]
copy

SYNOPSIS

ifdata [options] interface

DESCRIPTION

ifdata retrieves network interface information in a script-friendly format. Part of the moreutils package. Unlike ifconfig or ip, it returns single clean values without parsing. Exit codes indicate success/failure for conditional testing in scripts.

PARAMETERS

-e

Test if interface exists (exit code).
-pa
Print IP address.
-pn
Print netmask.
-pN
Print network address.
-pb
Print broadcast address.
-pm
Print MTU.
-ph
Print hardware (MAC) address.
-pf
Print flags.

INSTALL

sudo apt install moreutils
copy
sudo dnf install moreutils
copy
sudo pacman -S moreutils
copy
sudo apk add moreutils
copy
sudo zypper install moreutils
copy
brew install moreutils
copy
nix profile install nixpkgs#moreutils
copy

SEE ALSO

ip(1), ifconfig(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid