diff --git a/man/hostnamectl.xml b/man/hostnamectl.xml
index a06f403f34c..7410d3fcfa8 100644
--- a/man/hostnamectl.xml
+++ b/man/hostnamectl.xml
@@ -180,12 +180,15 @@
Alternatively, each argument may be prefixed with + or -
to incrementally update the configured tags rather than replacing them: an argument prefixed with
+ adds all of its (colon-separated) tags to the list, one prefixed with
- - removes them. For example, hostnamectl tags +foo:bar -quux:ooo
- adds the tags foo and bar and removes quux
- and ooo. The prefix applies to the whole argument, i.e. to every tag listed within
- it. Adding a key=value tag
- replaces any value previously assigned to the same key. Prefixed and unprefixed arguments may not be
- combined in a single invocation.
+ - specifies a removal pattern. For example, hostnamectl tags +foo:bar
+ -quux:ooo=* adds the tags foo and bar and removes
+ quux and any assignment of ooo=. The prefix applies to the
+ whole argument, i.e. to every tag listed within it. Adding a
+ key=value tag replaces any
+ value previously assigned to the same key. Prefixed and unprefixed arguments may not be combined in a
+ single invocation. Removal patterns may use shell-style globbing to remove any matching tags,
+ glob7.
+
If is specified, no TAG arguments may be
given. Instead, systemd-hostnamed is asked to apply the tag configuration
diff --git a/test/units/TEST-71-HOSTNAME.sh b/test/units/TEST-71-HOSTNAME.sh
index 414f3ff6011..bcecf3c98d0 100755
--- a/test/units/TEST-71-HOSTNAME.sh
+++ b/test/units/TEST-71-HOSTNAME.sh
@@ -474,7 +474,20 @@ testcase_tags() {
hostnamectl tags +foo=b
assert_eq "$(hostnamectl tags)" "foo:foo=b"
grep -x "TAGS=foo:foo=b" /etc/machine-info >/dev/null
- hostnamectl tags alpha:beta:quux
+
+ # A '*' suffix on a tag to remove removes all tags with that prefix, before tags are added.
+ hostnamectl tags company.x:company.bar=old:companyfoo:other
+ hostnamectl tags -- '-company.*' +company.foo:company.bar=waldo
+ assert_eq "$(hostnamectl tags)" "company.bar=waldo:company.foo:companyfoo:other"
+ hostnamectl tags -- '-company.*:other' -companyfoo +new
+ assert_eq "$(hostnamectl tags)" "new"
+ hostnamectl tags new:k=1:kx=2:kk:k
+ hostnamectl tags -- '-k=*'
+ assert_eq "$(hostnamectl tags)" "k:kk:kx=2:new"
+ # The '*' suffix is only allowed for removal
+ (! hostnamectl tags -- '+foo*')
+ (! hostnamectl tags -- 'foo*')
+ assert_eq "$(hostnamectl tags)" "k:kk:kx=2:new"
# Plain and prefixed arguments may not be mixed.
(! hostnamectl tags foo +bar)