Intermediate · 10 min · practise every command in the built-in terminal

A New Server — Its Name and Clock

A fresh server comes with a name and a time zone someone else picked. Setting them is among the first things to do.

The name: hostnamectl

hostnamectl
 Static hostname: linux
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 3f1c2b7e8a4d4c1e9b6f2d5e7a9c0b14
  Virtualization: kvm
Operating System: Debian GNU/Linux 13 (trixie)
          Kernel: Linux 6.12.111+deb13-amd64

Give it a name that says what it does:

sudo hostnamectl set-hostname web01

That writes /etc/hostname — and the prompt shows it at once: student@web01.

/etc/hosts too

sudo ls /root
sudo: unable to resolve host web01: Name or service not known

Debian lists the server's own name in /etc/hosts, on the 127.0.1.1 line — which still says the old one. Fix it (or edit it: sudo nano /etc/hosts):

sudo sed -i 's/127.0.1.1\tlinux/127.0.1.1\tweb01/' /etc/hosts

The clock: timedatectl

timedatectl
               Local time: Sun 2026-11-01 15:19:03 CET
           Universal time: Sun 2026-11-01 14:19:03 UTC
                 RTC time: Sun 2026-11-01 14:19:03
                Time zone: Europe/Skopje (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

NTP service: active — the clock keeps itself right over the network. The time zone came from where the server was installed (here: yours). It decides what date, the logs and cron call "02:30".

timedatectl list-timezones | grep Europe
sudo timedatectl set-timezone Etc/UTC

Many teams run every server on UTC: logs from servers in different countries line up, and there's no daylight saving time — no hour that happens twice in October, none in March.

⚠️ A new time zone moves your cron jobs: 30 2 * * * means 02:30 in the server's zone.

Practice tasks

  1. See the server's name and system
  2. Name the server web01
  3. Stop sudo's complaint: web01 in /etc/hosts
  4. See the clock and the time zone
  5. Put the server on UTC
  6. Check: date says UTC now

Commands in this lesson

Server Setup