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
-
Endless OS 6 has Arrived
After more than a year since the last update, the latest release of Endless OS is now available for general usage.
-
Fedora Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.