Using basic systemd commands
Hostnamectl
Systemd recognizes that hostnames have grown more varied over the years. The hostnamectl
command recognizes three types of hostname with its options: --static
is the traditional hostname, used to initialize the system at bootup; --transient
is the hostname assigned by a network; and --pretty
is the high-level name for humans to read, which may contain many characters that static and transient hostnames are not permitted to use. Then, just to complicate matters further, hostnamectl
can also adjust the hostname used in graphical interfaces. For example, set-icon-name NAME
sets the hostname displayed on a desktop, and set-chassis TYPE
designates a hostname as desktop, laptop, server, tablet, handset, or watch, to affect how they are displayed by some applications.
Use set-hostname NAME
to change a hostname, modifying it with an option as necessary. To view the current hostname, use the command status
. Add the option --host
(-H
) to change or view a hostname remotely. Note that a successful name change is marked only by a return to the command prompt.
Localectl
Locales are the languages and settings used for conventions such as currency and time and date formats. Locales typically begin with a two-letter lowercase abbreviation for the language, followed by an underscore and a two-letter uppercase abbreviation for the variant, and ending with an extension that indicates the character encoding – generally, .utf8
. For example, en_UK.utf8
stands for the English language as it is used in the United Kingdom. Keyboard maps specify the locale and the keyboard layout, such as Dvorak.
Under systemd, locales are managed by localectl
. The localectl
command can set the general system locale (set-locale LOCALE
), the locale for the X Window system, which includes the general system locale (set-x11-keymaps-variants
), and the keyboard locale (set-keymap MAP TOGGLE
). If you need to look up locales, you can use the command list-locales
for the display or list-keymaps
for the keyboard.
Loginctl
To begin using loginctl
, run the bare command to receive a list of current logins (Figure 3). If you want details for a session, add the sub-command session-status
. Adding the session to a subcommand, you can activate a session, forcing it to replace the one currently displayed – for example, lock-session
, unlock-session
, terminate-session
, or kill-session
.
Besides controlling logins, loginctl
can also be used to read what devices are being used by each account with show-user USER
and show-seat SEAT
.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.
News
-
Fedora 39 Beta is Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.
-
UbuntuDDE 23.04 Now Available
A new version of the UbuntuDDE remix has finally arrived with all the updates from the Deepin desktop and everything that comes with the Ubuntu 23.04 base.
-
Star Labs Reveals a New Surface-Like Linux Tablet
If you've ever wanted a tablet that rivals the MS Surface, you're in luck as Star Labs has created such a device.
-
SUSE Going Private (Again)
The company behind SUSE Linux Enterprise, Rancher, and NeuVector recently announced that Marcel LUX III SARL (Marcel), its majority shareholder, intends to delist it from the Frankfurt Stock Exchange by way of a merger.