Ifconfig / Output Pretty Json Via Pipe
Output Pretty Json Via Pipe
Display network interface configurations in a human-readable format.
<ifconfig> | jc <--ifconfig> -p <ifconfig> | jc <--ifconfig> -p #!/bin/bash
# Output Pretty Json Via Pipe
{{ifconfig}} | jc {{--ifconfig}} {{[-p|--pretty]}} When To Use
During a network troubleshooting session to verify interface settings.
Pro Tip
Use the '-a' flag to include all interfaces, including inactive ones, for a full network overview.
Command Builder
Tune the command before you copy it
<ifconfig> | jc <--ifconfig> -p Anatomy of Output
Understanding the result
eth0 Link encap:Ethernet HWaddr 08:00:27:3e:6d:58 Interface Name and Type Shows the interface name and type (eth0 is Ethernet).
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 IPv4 Address Information Displays the assigned IPv4 address, broadcast address, and subnet mask.
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interface Status Indicates if the interface is UP, operational, and statistics related to packet handling.
Power User Variants
Optimized versions
ifconfig -a | jc --ifconfig Output detailed info of all interfaces in JSON format.
Troubleshooting
Common pitfalls
ifconfig: command not found
Solution: Install net-tools package: sudo apt-get install net-tools
Cannot open /proc/net/dev: No such file or directory
Solution: Check if the system is using a compatible kernel.
eth0: error fetching interface information: Device not found
Solution: Verify the interface name with 'ip link show'.
Command Breakdown
What each part is doing
-
<ifconfig> - Base Command
- The executable that performs this operation. Here it runs Ifconfig before the shell applies any redirect operators.
-
<ifconfig> - ifconfig
- The value supplied for ifconfig.
-
<--ifconfig> - ifconfig
- The value supplied for ifconfig.
-
-p - p| pretty
- The value supplied for p| pretty.
-
-p - Command Option
- Tool-specific option used by this command invocation.
Alternative Approaches
Comparable commands in other tools
Alternative system operations tools for the same job.
pop Exo / Create Debian Compute Instance exo compute instance create --disk-size 10 <instance_name> -z <zone> --template '<Linux Debian 12 (Bookworm) 64-bit>' Jc / Output Pretty Json Via Magic Syntax jc -p <ifconfig> Pwsh / Determine Output Format From Powershell pwsh -OutputFormat <Text|XML> Wpm / Start Wpm Short Texts wpm --short