How to check the DHCP server on Ubuntu

This is if you need to know which server gave you your dynamic IP:

cat /var/lib/dhcp/dhclient.leases 

That’s it, Enjoy!

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

Change default storage location of docker containers on Ubuntu 18.04 and 18.10

This was tested on Docker version 18.09.4, build d14af54266, it includes ALL docker data.

Just edit/create a file inside /etc/docker named daemon.json and add the following:

{
"data-root": "/new_location"
}

then simply restart docker:

sudo service docker restart

Source:

https://docs.docker.com/engine/reference/commandline/dockerd/

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

Print a batch of files on Ubuntu 18.10

Here we will send a batch of files inside a directory to the default printer in Ubuntu.

First of all, you’d better define a default printer in your system by going to Printers and then select Use Printer by Default:

Next, just invoke the lpr command, e.g.

lpr *.pdf

That’s it, Enjoy!

Source: https://makandracards.com/makandra/24202-linux-how-to-print-pdf-files-from-the-command-line

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

Touchpad enable/disable script and shortcut on Ubuntu 18.10

If your laptop doesn’t have a working switch for turning on/off your touchpad, then this post is for you.

Create a script called disenable_touchpad.sh and add the following code to it:

!/bin/bash

state=$( gsettings get org.gnome.desktop.peripherals.touchpad send-events )

if [ "$state" == "'enabled'" ];then
gsettings set org.gnome.desktop.peripherals.touchpad send-events 'disabled' \
&& notify-send -i touchpad-disabled-symbolic "Touchpad" "Disabled"
else
gsettings set org.gnome.desktop.peripherals.touchpad send-events 'enabled' \
&& notify-send -i input-touchpad-symbolic "Touchpad" "Enabled"
fi

Mark the script as executable and move it to /usr/bin:

chmod +x disenable_touchpad.sh
sudo mv disenable_touchpad.sh /usr/bin/

Open Settings -> Keyboard, scroll to the bottom and press the + sign to assign a new keyboard shortcut:

Tested on Ubuntu 18.10, should work on any gnome-shell versions anyway!

Enjoy!

Sources: https://askubuntu.com/questions/844151/enable-disable-touchpad/1109515#1109515

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

How to fix Ubuntu dock still visible while screen is locked on 18.04 and 18.10

A very stupid bug that has been there for quite a while! Luckilly the fix has been released recently into the proposed repository for both Bionic & Cosmic (Disco as well).

Just enable the proposed updates from Software & Updates -> Developer Options -> Pre-released updates, then run the following commands:

sudo apt update
sudo apt install gnome-shell-extension-ubuntu-dock

Hit Alt+F2, write r and then press Enter (works for Xorg only, not Wayland)

Enjoy!

Source: https://bugs.launchpad.net/ubuntu/+source/gnome-shell-extension-ubuntu-dock/+bug/1769383

Posted in Linux | Tagged , , , , , , | 2 Comments

Fix QT Apps scaling issue on hidpi screens on Ubuntu

On my 5k screen, all QT apps look very tiny, such as keepassxc and Virtualbox.

The best solution I found was adding the following to your .profile to autoscale at a ratio of 2 (you can change it to your preference):

export QT_SCALE_FACTOR=2

Set to 2 because my display settings are set to 2

Log out and back in, and there you go!

Tested on Ubuntu 18.10

Enjoy!

Sources: https://unix.stackexchange.com/questions/433385/scaling-hidpi-issue-for-qt5-applications-under-gnome

Posted in Linux | Tagged , , , , | 2 Comments

How to kill all processes accessing a filesystem on Ubuntu

This is not really safe, ok 😀 ? Do it at your own risk

lsof | grep /filesystem_name | awk '{print $2}' | xargs kill -9

That’s it, Enjoy!

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