diff --git a/man/networkctl.xml b/man/networkctl.xml
index 562ca3c6a7..5e2126ff21 100644
--- a/man/networkctl.xml
+++ b/man/networkctl.xml
@@ -454,12 +454,16 @@ s - Service VLAN, m - Two-port MAC Relay (TPMR)
cat
- FILE|@DEVICE…
+ FILE|@DEVICE…
- Show network configuration files. This command honors
- the @ prefix in the same way as edit.
+
+ Show network configuration files. This command honors the @ prefix in the
+ same way as edit. When no argument is specified,
+ networkd.conf5
+ and its drop-in files will be shown.
-
+
+
diff --git a/src/network/networkctl-config-file.c b/src/network/networkctl-config-file.c
index 670f1c2fd7..216e9d4954 100644
--- a/src/network/networkctl-config-file.c
+++ b/src/network/networkctl-config-file.c
@@ -476,12 +476,16 @@ int verb_edit(int argc, char *argv[], void *userdata) {
int verb_cat(int argc, char *argv[], void *userdata) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
+ char **args = strv_skip(argv, 1);
int r, ret = 0;
pager_open(arg_pager_flags);
+ if (strv_isempty(args))
+ return conf_files_cat(NULL, "systemd/networkd.conf", CAT_FORMAT_HAS_SECTIONS);
+
bool first = true;
- STRV_FOREACH(name, strv_skip(argv, 1)) {
+ STRV_FOREACH(name, args) {
_cleanup_strv_free_ char **dropins = NULL;
_cleanup_free_ char *path = NULL;
const char *link_config;
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 56fa373b1d..46f7d50369 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -2982,7 +2982,7 @@ static int help(void) {
" reconfigure DEVICES... Reconfigure interfaces\n"
" reload Reload .network and .netdev files\n"
" edit FILES|DEVICES... Edit network configuration files\n"
- " cat FILES|DEVICES... Show network configuration files\n"
+ " cat [FILES|DEVICES...] Show network configuration files\n"
" mask FILES... Mask network configuration files\n"
" unmask FILES... Unmask network configuration files\n"
" persistent-storage BOOL\n"
@@ -3142,7 +3142,7 @@ static int networkctl_main(int argc, char *argv[]) {
{ "reconfigure", 2, VERB_ANY, VERB_ONLINE_ONLY, verb_reconfigure },
{ "reload", 1, 1, VERB_ONLINE_ONLY, verb_reload },
{ "edit", 2, VERB_ANY, 0, verb_edit },
- { "cat", 2, VERB_ANY, 0, verb_cat },
+ { "cat", 1, VERB_ANY, 0, verb_cat },
{ "mask", 2, VERB_ANY, 0, verb_mask },
{ "unmask", 2, VERB_ANY, 0, verb_unmask },
{ "persistent-storage", 2, 2, 0, verb_persistent_storage },
diff --git a/test/units/testsuite-74.networkctl.sh b/test/units/testsuite-74.networkctl.sh
index 6cd5267b72..d05de17bde 100755
--- a/test/units/testsuite-74.networkctl.sh
+++ b/test/units/testsuite-74.networkctl.sh
@@ -15,6 +15,8 @@ at_exit() {
{/usr/lib,/etc}/systemd/network/"$LINK_NAME" "/etc/systemd/network/${NETWORK_NAME}.d" \
"new" "+4"
fi
+
+ rm -f /run/systemd/networkd.conf.d/10-hoge.conf
}
trap at_exit EXIT
@@ -110,3 +112,12 @@ ip_link="$(ip link show test2)"
if systemctl --quiet is-active systemd-udevd; then
assert_in 'alias test_alias' "$ip_link"
fi
+
+mkdir -p /run/systemd/networkd.conf.d
+cat >/run/systemd/networkd.conf.d/10-hoge.conf <