Setting Timezone in Linux

There are two ways of changing the system timezone in Linux, either you use timedatectl or changing the /etc/localtime symbolic link and pointing it to your chosen timezone at /usr/zoneinfo/

Solution: Using timedatectl

Step 1

Check the available zones first, which in turn will be provided when we set the timezone you’re gonna use for your system.

timedatectl list-timezones

This will show you all available timezone you can set. You can also use /usr/zoneinfo for the list but this one’s a lot easier than checking each folder for approriate zones.

Step 2

Now let’s set your timezone. In my case I’ll use Asia/Manila as my timezone.

timedatectl set-timezone Asia/Manila

Step 3

Once set, you can now verify if your timezone is currently used by your system. You can run either date or timedatectl. Running just timedatectl defaults to timedatectl status, so there’s no need to do it the long way.

Solution 2: Change Symlink of /etc/localtime

If you’ll check were the /etc/localtime is being point to, you’ll see it’s at /usr/share/zoneinfo/[TIME_ZONE]

readlink -f /etc/localtime

Step 1

Root holds owner of the file, and has a 777 permission. So first let’s remove the symlink

sudo rm -rf /etc/localtime

Step 2

Doing the long way to search and confirm for your timezone, and look for it at /usr/share/zoneinfo

You can do a recursive search to make it easier

ls -R /usr/share/zoneinfo

Step 3

Once you know the timezone to set. Now create a symlink:

sudo ln -s /usr/share/zoneinfo/Asia/Manila /etc/localtime

Step 4

Verify if your system is now using your selected timezone:



  1. timedatectl Manual
  2. /etc/localtime Manual

Written with StackEdit.

Use Raspberry PI 4 model B as Local Network Private DNS server on Ubuntu

Tested on the following Ubuntu Version

  • Ubuntu 19.10 (eoan)

There’s not much configuration change when configuring Bind 9 on an ARM architecture over an x86 or x64 this steps can be interchangeable except for different Linux distro which places default configuration files on a different folder (e.g CentOS uses /etc/named while Ubuntu uses /etc/bind) or some preset configurations has already been set and default config locations.

Step 1

Install Bind 9 DNS Server, Bind 9 Utilities and Bind 9 Docs

sudo apt install bind9 bind9utils dnsutils bind9-doc

Step 2

Make sure Bind 9 uses only IPv4, add named arguments for IPv4:

sudo vi /etc/default/bind9

Then add -4 on OPTIONS

# run resolvconf?

# startup options for the server
OPTIONS="-4 -u bind"

Step 3

After installation we’re gonna remove some preset. First, open /etc/bind/named.conf.options

sudo vi /etc/bind/named.conf.options

Then remove the following line:

listen-on-v6 { any; };

Then add the following inside options { ... };

// Allow dns query on localhost and all host within the subnet
allow-query     { localhost;; };
// Listen on port 53 with any IP or host (This is the default). 
// In case you're using DHCP for your IP 
// or there are not any statically assigned IP for you NS. 
// You can also use your subnet's CIDR.
listen-on port 53 {any;}

Step 4

Now, we’re gonna add Zone configuration and configure each zone files.

sudo vi /etc/bind/named.conf.default-zones

For CentOS/Fedora, the default file can be at /etc/named.conf.local Then add the following line:

zone "" {
    type master;
    file "/etc/bind/db.1.168.192";
    allow-update { none; };

zone "" {
    type master;
    file "/etc/bind/";
    allow-update { none; };

Step 5

After setting up the zone info, we’ll now proceed at configuring each zone. First create /etc/bind/ and add the following:

TTL    604800
@    IN    SOA (
     6        ; Serial
     604800   ; Refresh
     86400    ; Retry
     2419200  ; Expire
     604800 ) ; Negative Cache TTL
; name servers - NS records
    IN    NS
; name servers - A records
ns1      IN    A
desktop  IN    A

Next, create the reverse lookup record, /etc/bind/db.1.168.192

$TTL 604800
@ IN SOA (
          5     ; Serial
    6048000     ; Refresh
      86400     ; Retry
    2419200     ; Expire
     604800 )   ; Negative Cache TTL
@  IN NS
; PTR Records
101    IN    PTR     ;
200    IN    PTR ;

Step 6

After creating DNS record, we’ll have to test the configuration. To check the configuration files for error run named-checkconfig

sudo named-checkconfig

This will output the error and on which specific line the error occurred on your config file. It won’t output any if there are no error on your configurations. For your zone file, we’ll use named-checkzone. This requires you to input the zone name and zone file. In our case, we’ll do the following:

sudo named-checkzone
sudo named-checkzone db.1.168.192

It will output OK if no issues are found in your zone file/s.

Step 7

When all configurations are set we’ll have to start/restart the bind9 service.

sudo server bind9 start

Step 8

Make sure you have set your new server as the default or primary DNS on you client/s. To check if your client can now query from your DNS, do the following:

# use `@` to query on the specific DNS
# We're using `localhost` since we're inside the DNS
#   if you're on your client, you have to provide the DNS IP
dig @localhost
# For reverse lookup
dig -x @localhost

# Don't point to the DNS if you already have configured your
#   client's network interface's DNS, 
#   pointing at your new server
# For reverse lookup
dig -x


  1. MIT Bind Config
  2. ISC: Bind 9 Documentation
  3. ISC: Bind 9.14 named.conf Docs

Written with StackEdit.

Install PlatformIO Binaries in Ubuntu Linux

Step 1 (Optional)

Before doing this step, make sure you already have installed Python’s distutils . To do this, run the command below:

sudo apt-get install python3-distutils

Step 2

Get and run the installer:

python3 -c "$(curl -fsSL"

Step 3

Create symbolic links to /usr/local/bin

sudo ln -s ~/.platformio/penv/bin/platformio /usr/local/bin/platformio
sudo ln -s ~/.platformio/penv/bin/pio /usr/local/bin/pio
sudo ln -s ~/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb

Note: After this, you can now use PlatformIO plugin in Clion without hiccups


  1. PlatformIO Utility Installation

Written with StackEdit.

Enable Wifi on Raspbian Using WPA Supplicant

Step 1

Edit your wpa_supplication config file.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 

Step 2

Then copy and paste the configurations below and edit the SSID and WIFI PASSWORD.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    psk="[WIFI PASSWORD]"

Note: Double check your own Wifi settings and change the network configuration as you see fit. See WPA Supplicant Config Documentation for details. Also use iwlist [NET INTERFACE] scan to get more infor on your Wifi settings

Note on Hidden SSID: If you’re using hidden SSID for your Wifi hotspot, make sure to use scan_ssid=1 This uses probe request specific to your hidden SSID, and has a high latency.

Step 3

After setting the WPA Supplicant configurations. Restart your network manager with:

sudo service networking restart

Note: If restarting your network manager doesn’t connect you to wifi. Restart your board.


  1. WPA Supplicant Configuration Documentation

Written with StackEdit.

Show Free and Used Memory in Linux

The free comman can be used to show the free and used memory on both RAM and Swap files.

Sample Usage

List Free and Used Memory in Either Kilobytes, Megabytes or Gigabytes


free -k
# or
free -kilo


free -m
free --mega


free -g
# or
free --giga

Show List in Human Readable Format

free -h
# or
free --human

Display the List of Block Devices in Linux (e.g. Hard Disk, CD-ROM, Flash Drive)

When you want to find out the list of block devices in your computer, you can use lsblk.

Sample Usage

List block devices


List all block devices


List all SCSI devices

Please take note of the capital ‘S’

lsblk -S

Specifically list column

You can get all the available columns by running lsblk -h.



Fix SSH Login `Too many authentication failures` Due To Multiple SSH Keys

When loging in to your one of your remote server with or without a password and you got the Too many authentication failures error, then its your ssh client using multiple irrelivant keys for authentication. There are two ways to get out from this. One: Explicitly indicate you’re using password as your method of authentication, if you’re using one. Or, Two: specify SSH to use only relevant identity.

Specific Authentication Method Using Password Only

ssh -o 'PreferredAuthentications password'

Use Identity Only

ssh -o 'IdentitiesOnly yes'

Using Linux XCLIP

xclip is a command line utility for setting and getting values on the clipboard using other command’s output or input. Instead of directly using shortcut keys on the terminal, xclip can be used likewise except you have to pipe the output and input from other commands.

In general here’s the three(3) selection for xclip

  • Primary – Used for the 3rd mouse button
  • Secondary – Act’s as an alternative to primary
  • Clipboard – GUI or window-style clipboard using the shortcut keys (ctrl+c, ctrl+shift+v)

Sample Usage

Copying directory listing to clipboard

ls | xclip -selection c
# Alternative
ls | xclip -selection clipboard

Outputing clipboard

xclip -o -selection c

Outputting clipboard content to a file

xclip -o selection c > somefile

Aliasing xclip

Since clipboard‘s the common selection for xclip we can just create an alias on our ~/.bashrc file or system-wide /etc/bashrc, if you’re using bash.


echo "alias xclip='xclip -selection clipboard'" >> ~/.bashrc 
source ~/.bashrc


echo "alias xclip='xclip -selection clipboard'" >> /etc/bashrc
source /etc/bashrc