Linux command
ifquery 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Query configuration
ifquery [eth0]
List
ifquery --list
Example
ifquery --state
Example
ifquery --list --allow [hotplug]
Example
ifquery --check [eth0]
说明
ifquery queries network interface configuration as defined in /etc/network/interfaces and its interfaces.d/ drop-in directory. It is read-only and never modifies interface state. When called without --state, it parses the configuration file and prints the stanzas matching the given interface(s). With --state, it reads /run/network/ifstate to show which interfaces are currently marked as up. On systems using ifupdown2 (common on newer Debian/Ubuntu), additional features are available including --check to compare running state against configuration and JSON output.
参数
- -a, --all
- Query all interfaces marked auto in the configuration.
- --list
- List matching interface names instead of printing their configuration. Combine with --all or --allow to filter.
- --state
- Query the state file (/run/network/ifstate) for currently active interfaces rather than the configuration file.
- --check
- Compare running interface state against its configuration and report differences (ifupdown2 only).
- --allow _CLASS_
- Only match interfaces in the given allow class (e.g. auto, hotplug).
- -i, --interfaces _FILE_
- Read configuration from _FILE_ instead of /etc/network/interfaces.
- --force
- Force the operation (used with some queries in ifupdown2).
- -V, --version
- Display version information.
- -h, --help
- Display help information.
FAQ
What is the ifquery command used for?
ifquery queries network interface configuration as defined in /etc/network/interfaces and its interfaces.d/ drop-in directory. It is read-only and never modifies interface state. When called without --state, it parses the configuration file and prints the stanzas matching the given interface(s). With --state, it reads /run/network/ifstate to show which interfaces are currently marked as up. On systems using ifupdown2 (common on newer Debian/Ubuntu), additional features are available including --check to compare running state against configuration and JSON output.
How do I run a basic ifquery example?
Run `ifquery [eth0]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --all do in ifquery?
Query all interfaces marked auto in the configuration.