Nouvelles commandes Linux


Commandes dépréciées

Commande dépréciéeNouvelle commande
netstatss
netstat -iip -statistics link
netstat -gip maddress
ifconfigip address
ip link
ip -statistics address
ip -statistics link
routeip route
nameif ip link
arpip neighbour
iptunnelip tunnel
iwconfigiw

Systemd

systemd-timesyncd

C’est un remplaçant de ntp, plus léger et avec moins de fonctionnalités (client NTP uniquement…).

Fichier de configuration : /etc/systemd/timesyncd.conf

Exemple de contenu basique :

[Time]
NTP=0.debian.pool.ntp.org

Quelques commandes intéressantes :

root@naia:~# timedatectl status
               Local time: Tue 2020-11-10 17:57:36 CET
           Universal time: Tue 2020-11-10 16:57:36 UTC
                 RTC time: n/a
                Time zone: Europe/Paris (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
root@naia:~# timedatectl show
Timezone=Europe/Paris
LocalRTC=no
CanNTP=yes
NTP=yes
NTPSynchronized=yes
TimeUSec=Tue 2020-11-10 17:59:05 CET
root@naia:~# timedatectl timesync-status
       Server: 91.121.173.59 (ntp.elysiria.org)
Poll interval: 34min 8s (min: 32s; max 34min 8s)
         Leap: normal
      Version: 4
      Stratum: 3
    Reference: 91EECB0A
    Precision: 1us (-24)
Root distance: 54.831ms (max: 5s)
       Offset: +5.500ms
        Delay: 22.908ms
       Jitter: 33.461ms
 Packet count: 82
    Frequency: -3.258ppm

systemd-networkd

C’est une nouvelle manière de configurer le réseau sur le serveur, plus complet et moins buggé que networking.

Fichiers de configuration : /etc/systemd/network/*.link et /etc/systemd/network/*.network

Exemple de contenu basique :

root@naia:~# cat /etc/systemd/network/50-public-interface.link
[Match]
MACAddress=b8:27:eb:aa:bb:cc
[Link]
Description=network interface on public network, with default route
MACAddressPolicy=persistent
#NamePolicy=kernel database onboard slot path mac
Name=eno1

root@naia:~# cat /etc/systemd/network/80-bridge-ext.network
[Match]
MACAddress=b8:27:eb:aa:bb:cc
[Network]
Description=Public bridge interface
DHCP=no
Address=192.168.1.200/24
Gateway=192.168.1.1
[Network]
IPv6AcceptRA=yes

timers

C’est la version plus élaborée de cron.

Fichiers de configuration : /etc/systemd/system/XXX.timer et /etc/systemd/system/XXX.service (on a autant de fichiers XXX qu’on le désire, et le XXX entre les fichiers timer et service doivent être identiques).

Exemple de contenu :

root@naia:~$ cat /etc/systemd/system/syshawk-backup.timer
[Unit]
Description=Run Syshawk Backup once a day
[Timer]
OnCalendar=*-*-* 04:30:00
RandomizedDelaySec=1800
Persistent=True
[Install]
WantedBy=timers.target

root@naia:~$ cat /etc/systemd/system/syshawk-backup.service
[Unit]
Description=Syshawk Backup
[Service]
Type=oneshot
ExecStart=/usr/sbin/syshawk-backup backup
User=restic
PrivateTmp=true

Quelques commandes intéressantes :

root@naia:~$ systemctl list-timers
NEXT                         LEFT     LAST                         PASSED  UNIT                 ACTIVATES
Wed 2020-11-11 04:41:30 CET  10h left Tue 2020-11-10 04:39:07 CET  13h ago syshawk-backup.timer syshawk-backup.service

1 timers listed.
Pass --all to see loaded but inactive timers, too.

systemd-journald

C’est un remplaçant de tous les syslog locaux.

Quelques commandes intéressantes :

# voir tout le journal
journalctl
# voir les 10 dernières lignes du journal
journalctl -n 10
# suivre les écritures dans le journal
journalctl -f
# afficher uniquement les messages d'erreur (allant du niveau 0 "emerg" à 3 "error")
journalctl -p 0..3
# taille du stockage des logs
journalctl --disk-usage

Laissez un commentaire

Votre adresse e-mail ne sera pas publiée.