Create an alias for microk8s.kubectl as kubectl on Ubuntu

sudo snap alias microk8s.kubectl kubectl

Sources:

https://github.com/ubuntu/microk8s/issues/20

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'.
3.65*549
2003.85

That’s it, Enjoy!

Source: https://fedoramagazine.org/bc-command-line-calculator/

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:

#!/bin/bash 

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/scale_me_please.sh and make it executable:

sudo chmod +x /usr/bin/scale_me_please.sh

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

scale_me_please.sh 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"
EndSection

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.

Enjoy!

Sources:

https://wiki.archlinux.org/index.php/Intel_graphics#Tearing

https://askubuntu.com/questions/1029436/enable-fractional-scaling-for-ubuntu-18-04

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

Using gzip to compress a file without overriding it

gzip < source_file > compressed_file.gz

Source:

https://unix.stackexchange.com/questions/46786/how-to-tell-gzip-to-keep-original-file

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!

Sources:

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

Source:

https://askubuntu.com/questions/82480/how-to-see-all-computers-connected-to-a-network

Posted in Linux | Tagged , , | Leave a comment