List network adapters connected to Ubuntu Server

sudo ls /sys/class/net

Source: https://askubuntu.com/questions/296152/how-to-check-what-is-my-network-card-on-ubuntu

Posted in Ubuntu | Tagged , | Leave a comment

Validate xml files with xmlstarlet on Ubuntu

sudo apt install xmlstarlet
xmlstarlet val XML_FILE.xml
Posted in Linux | Tagged , , | Leave a comment

How to resolve KDE Connect App losing connection with Linux after screen is locked on Huawei Phones

I tested on my P10 Plus, but this can work on other Huawei phones as well I believe. I have EMUI 8 with Android 8 and my OS is Ubuntu 18.10 with GSConnect

  • Go to Ignore Battery Optimization -> Change from Allowed to All Apps -> Navigate to KDE Connect and choose Allow
  • Go to Apps -> KDE Connect -> Open by default -> Battery -> Change Launch to Manage manually -> Select all options
  • Restart your phone and open the KDE Connect App

Enjoy!

Sources:

https://github.com/Bajoja/indicator-kdeconnect/issues/43

Posted in Android, Ubuntu | Tagged , , , , , | 1 Comment

Best way to exclude a folder from your search using the “find” command

I found it to be the fastest and most effective way to use the find command and exclude specific folders. That is using the “prune” option:

find /FOLDER_TO_SEARCH_INSIDE -path /FOLDER_TO_EXCLUDE -prune -o -name 'NAME_OR_PATTERN_TO_SEARCH_FOR' -print

That’s it, Enjoy!

Source:

https://stackoverflow.com/questions/4210042/how-to-exclude-a-directory-in-find-command

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

How to beautify XML text on command line in Ubuntu

sudo apt install libxml2-utils
echo 'your xml stuff here' | xmllint --format -

You will get a beautiful well-organized XML output.

Sources:

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

Cleanup Docker Trash

Over time, docker images and residual unneeded files pile up and take a lot of space.

We need to cleanup the following:

  • stopped containers
  • networks not used by at least one container
  • dangling images
  • build cache

To do that, just run:

docker system prune

It might take some time.

Enjoy a clean environment!

Sample:

WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Deleted Images:
untagged: xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx
deleted: sha256:xxxxxxxxxxx

Total reclaimed space: 17.89GB

Source:

https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

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

Flush the DNS cache on Ubuntu 18.04

sudo systemd-resolve --flush-caches

Source:

https://askubuntu.com/questions/906476/how-can-i-flush-the-dns-on-ubuntu-17-04

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