Local time settings in Linux

To check the current date and time settings:

~# timedatectl

                      Local time: Thu 2020-04-23 16:38:10 EEST

                  Universal time: Thu 2020-04-23 13:38:10 UTC

                        RTC time: Thu 2020-04-23 13:38:11

                       Time zone: Europe/Kiev (EEST, +0300)

       System clock synchronized: yes

systemd-timesyncd.service active: yes

                 RTC in local TZ: no

or 

~# cat /etc/timezone

Europe/Kiev

So, if we should select a needed time zone and we don’t know what is it. Let’s find New York zone:

~# timedatectl list-timezones | grep New

America/New_York

America/North_Dakota/New_Salem

Then we going to set a new time zone:

~# timedatectl set-timezone America/New_York && timedatectl && cat /etc/timezone

                      Local time: Thu 2020-04-23 09:45:27 EDT

                  Universal time: Thu 2020-04-23 13:45:27 UTC

                        RTC time: Thu 2020-04-23 13:45:28

                       Time zone: America/New_York (EDT, -0400)

       System clock synchronized: yes

systemd-timesyncd.service active: yes

                 RTC in local TZ: no

America/New_York

Do not forget to run these command under root or side mode.

Than it.

Have You More questions? Please be free to ask us your questions in the
Dzhumaiev.Slack.com channel 🙂

Configure IP address on Ubuntu 18.04

Check does exist netplan in the current Ubuntu installed distro

$ ls /etc/net <let's tap Tab>
netplan/             network/             networkd-dispatcher/ networks
$ ls /etc/netplan/50-cloud-init.yaml

Edit this *.yaml file

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        ens18:
            addresses:
            - 192.168.1.100/24
            gateway4: 192.168.1.1
            nameservers:
                addresses:
                - 192.168.1.1
                - 8.8.8.8
    version: 2

So, you can edit address: value in whatever you need, then save and close this file

Finally, apply changes with netplan command:

$ netplan apply
ERROR: cannot create file run/systemd/network/10-netplan-ens18: Failed to create file “/run/systemd/network/10-netplan-ens18.network.J87WE0”: Permission denied
$ sudo netplan apply
[sudo] password for someuser:
$

Oh, yes, sure, you have to have sudo permissions 🙂

For sure let’s do debug:

sudo netplan --debug apply
** (generate:11510): DEBUG: 21:21:36.262: Processing input file /etc/netplan/50-cloud-init.yaml..
** (generate:11510): DEBUG: 21:21:36.262: starting new processing pass
** (generate:11510): DEBUG: 21:21:36.262: ens18: setting default backend to 1
** (generate:11510): DEBUG: 21:21:36.263: Configuration is valid
** (generate:11510): DEBUG: 21:21:36.263: Generating output files..
** (generate:11510): DEBUG: 21:21:36.263: NetworkManager: definition ens18 is not for us (backend 1)
DEBUG:netplan generated networkd configuration changed, restarting networkd
DEBUG:no netplan generated NM configuration exists
DEBUG:ens18 not found in {}
DEBUG:Merged config:
network:
  bonds: {}
  bridges: {}
  ethernets:
    ens18:
      addresses:
      - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
        - 192.168.1.1
        - 8.8.8.8
  vlans: {}
  wifis: {}

DEBUG:Skipping non-physical interface: lo
DEBUG:device ens18 operstate is up, not changing
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for ens18

is it OK? I believe you well done!

Have You More questions? Please be free to ask us your questions in the
Dzhumaiev.Slack.com channel 🙂

CLI or Terminal goes to be colour

How to switch on a colored terminal by CLI?


Edit user’s shell config file


~$ nano ~/.bashrc

Find out the string with the commented parameter ” force_color_prompt ” and uncomment them with value yes

# uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt force_color_prompt=yes if [ -n “$force_color_prompt” ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support;

Save and close .bashrc

Log off and log in again to see changes

This image has an empty alt attribute; its file name is Screenshot_9.png

Have You More questions? Please be free to ask us your questions in the
Dzhumaiev.Slack.com channel 🙂