Create an alias for microk8s.kubectl as kubectl on Ubuntu

sudo snap alias microk8s.kubectl kubectl


Posted in Linux | Tagged , , | Leave a comment

bc: A command-line calculator for Ubuntu

It’s simple, but effective for command line addicts

If it’s not already installed, install it by using:

sudo apt install bc

then run bc and type any calculations you want. I wrote for example

$ bc
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.

That’s it, Enjoy!


Posted in Linux | Tagged , , | Leave a comment

Set fractional display scaling on Ubuntu 18.10 (XORG)

I am using an LG 5K monitor, and the display scaling options are very limited in gnome-shell, only increments of 100%.

To have fractional scaling, I tried this script:


gsettings set org.gnome.desktop.interface scaling-factor 2
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <2>}"
xrandr --output DP-1 --scale $1x$1

I added that in a script inside /usr/bin/ and make it executable:

sudo chmod +x /usr/bin/

Now, whenever I am at work and need to scale it, I just run: 1.4

Just perfect!

Update: This change has introduced some screen tearing for me on Intel graphics. The solution was to add the following:

Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"

To /etc/X11/xorg.conf.d/20-intel.conf

For some reason, this changed my display from DP-1 to DP1, so I modified my script replacing the former with the latter.



Posted in Ubuntu | Tagged , , , , | Leave a comment

Using gzip to compress a file without overriding it

gzip < source_file > compressed_file.gz


Posted in Linux | Tagged , , , | Leave a comment

Resize root filesystem on Ubuntu 18.04 with LVM

Ubuntu 18.04 default lvm layout comes with only a 4 GB root partition. Here we will extend it to occupy the full free space in the volume group:

sudo lvextend -l 100%FREE --resizefs /dev/ubuntu-vg/ubuntu-lv

That’s it, Enjoy!


Posted in Linux | Tagged , , , , | Leave a comment

How to scan for devices in your network in Ubuntu

sudo apt install arp-scan
sudo arp-scan -l --interface=wlp2s0

Replace wlp2s0 with your NIC’s name, works for both wireless and wired


Posted in Linux | Tagged , , | Leave a comment