Printing file between two patterns

WIth sed

sed -n '/StartPattern/,/EndPattern/p' FileName

With awk

awk '/StartPattern/,/EndPattern/' FileName

Archlinux automated installation script (for VM)

Disclaimer: use this at your own risk. No warranties are given.

I got bored typing stuff in arch for basically every time same installation. Everything after pacstrap can also be used for live system. Just be sure to not run partitioning by default on someone’s desktop.

Here’s the script:


# prereqs: vm with working network
# limitations: 1 drive, 1 network card
# instructions:
# when booted archiso, 
# 1. systemctl start sshd
# 2. passwd root
# 3. remote login
# 4. start bash by typing bash (arch by default uses ksh)
# 5. then run this script by c/p it into the open terminal window
#    (it has to be done like this because of arch-chroot)

BLOCK_DEVICE_SHORT=$(lsblk -dn -o NAME,TYPE | awk '{ if ($2 == "disk") { print $1 } }' | head -n 1)

if [ ! -f /etc/pacman.d/mirrorlist.orig ]; then 
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig

grep ".de/" /etc/pacman.d/mirrorlist.orig > /etc/pacman.d/mirrorlist

parted --script /dev/vda -s \
mklabel msdos \
mkpart primary 1MiB 1GiB \
mkpart primary 1GiB 100% \
set 1 boot on \

mkfs.xfs -f "${BLOCK_DEVICE}1"
mkfs.xfs -f "${BLOCK_DEVICE}2"

mount /dev/vda2 /mnt
mkdir -p /mnt/boot
mount /dev/vda1 /mnt/boot

pacstrap /mnt base lz4 grub mc vim openssh

genfstab -U /mnt >> /mnt/etc/fstab

arch-chroot /mnt bash

ln -sf /usr/share/zoneinfo/Europe/Vienna /etc/localtime

sed -i "/^#en_US\.UTF-8 UTF-8/s/^#//" /etc/locale.gen



echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=us" > /etc/vconsole.conf
echo "$HOSTNAME" > /etc/hostname

cat > /etc/hosts <<EOL localhost
::1 localhost $HOSTNAME.localdomain $HOSTNAME

NETWORK_INTERFACE=$(ls /sys/class/net | grep -v "lo" | head -n 1)

cat > /etc/systemd/network/ <<EOL


sed -i "/^#.*lz4/s/^#//" /etc/mkinitcpio.conf

mkinitcpio -p linux

BLOCK_DEVICE_SHORT=$(lsblk -dn -o NAME,TYPE | awk '{ if ($2 == "disk") { print $1 } }' | head -n 1)

grub-install --target=i386-pc $BLOCK_DEVICE
grub-mkconfig -o /boot/grub/grub.cfg

systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl enable sshd
useradd -m -g wheel -G users -s /bin/bash <me-as-a-user>
echo "root:<password-to-be-set>" | chpasswd

# pacman -S sddm plasma-desktop plasma-wayland-session konsole kate dolphin papirus-icon-theme && systemctl enable sddm


If you want additionally to try something, then

pacman -S spice-vdagent qemu-guest-agent virglrenderer xf86-video-qxl

systemctl enable spice-vdagentd

KDE Plasma 5.15 review (Kubuntu 1904)

KDE Plasma Version 5.15.4

KDE Frameworks Version 5.56.0

TLDR;  How can i put it… breeze is not good. KDE design team needs to look up to elementary, mac or some other player known for design.


  • red -> bugs
  • blue -> defaults proposals
  • green -> irony


  • generic issues
    • kscreen should be part of system-settings package, not installed separately. otherwise, why not split every settings screen into its own app?
    • power management under wayland doesn’t work. when you leave your pc inactive to turn off monitors for extended period of time, they wont turn back on. you basically have to hard-reset. huge issue still unresolved after a long time.
    • sddm and lockscreen are not aligned (e.g. icons), sddm is not scaled properly when using 4k
    • overall visuals need to be addressed:

      • toolbar icons need to be better, look into elementary
      • contrast and colors
      • fonts
    • baloo should be disabled by default on new installations
    • nothing on the web is actually up to date., and (what is userbase?) all need to be nuked, archived or moved. when i tried to find anything there it would outdated, difficult to find and just insufficient for anything. let’s not pretend there is documentation on something.
      • where is a link to forum on the main website?
      • where is a link to hid on the main website?
  • missing apps
    • no ide in native toolkit for newer languages, like golang, rust. will there not be an alternative to electron based vscode?
      • we had to get microsoft to develop for linux to have a nice ide? oh, the irony…
  • discover
    • first thing after installation of kubuntu, i remove this thing. i know it is a test bed for kirigami and in the future for the phone, but omg this is badly designed. there was a design of muon a long time ago which i cannot find now, but this was waaaay better.
  • shell
    • going into tray options causes national geographic plugin to fail
    • use icon-only task manager by default
    • three icons in log out menu serve no purpose because they take you to a screen where you need to pick again. this workflow should be changed.
    • often crashes when changing taskbar/panel/widgets under wayland
  • desktop settings
    • do not use desktop toolbox, is this used by anyone in the real world?
    • wallpapers. thank you for having a contest, but photos might work better than some abstract picture. look up to mac or elementary and just do what they do.
  • konversation
    • configuration is a mess. server list should be part of settings not split into 10 dialogs
  • dolphin
    • inconsistent ui: by default there is no way to distinguish normal button (e.g. find, back), toggle button (e.g. show pictures) and menu (e.g. control)
    • inconsistent lining of UI elements (when you select 1st item in places aka home, selection is several pixels higher than container of icons)
    • icons with “show pictures” enabled and disabled should be using same icon size.
    • not sure if this is the reason for .directory files everywhere, but avoid that by defaulting to use default properties for all folders
    • there is no way to disable animation of icons moving slowly together or apart when resizing (e.g. dolphin) window, i find this delayed action annoying.
    • disable “show selection marker” by default. “simple by default”, ha?
  • konsole
    • default profile should have copy on select trim leading and trailing spaces, paste from clipboard
  • kate
    • blue line on the selected document. why is it on the bottom of the tab?
    • find/replace dialog popping up from the bottom? does it have to be different to all other editors and it adds nothing better, just breaks workflow?
  • ksysguard
    • graphs need to be better designed and more fluid.
    • default selection should be “all processes – tree”
  • settings defaults
    • ui
      • all kind of improvements are needed
      • install addons screenshot is really small, has no purpose because e.g. look-and-feel cannot be seen on an icon. this needs some other gui, because this may functionally work, but is just a pain to use. also which file from the list should i install from the list for any given theme? probably the one that has bigger number, but what if there are 3 having the same number?
    • colors/fonts
      • do not invert font colors on selection
      • pick a different default font. i’ve found that ubuntu works much better than noto
      • notification close button has blue outline, but normal window has red?
    • window decorations / breeze
      • title alignment: left
      • button size – large
      • draw a circle – no
      • draw titlebar gradient – no
    • desktop behavior
      • single click behavior by default? this is not a webpage.
      • many desktop effects give impression of slow system (e.g. too long animations). not that many should be enabled by default, it just looks cheap
        • disable login and logout (smooth)
        • disable morphing popups
        • disable sliding popups
        • disable squash
      • screenlocking should be activated by meta-l instead of ctrl-alt-l by default (it works like this on windows and gnome, never used mac, someone knows how it works there?).
      • screen gets locked after 5 minutes. screen gets turned off after 10. why 5 minutes of showing the lockscreen? this should be linked and used as in gnome
    • shortcuts
      • meta-e -> run dolphin
      • meta-l -> lock screen

Few things to do after fresh Ubuntu install

Install a few packages

apt install nfs-common mc openssh-server tilix gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad papirus-icon-theme gnome-tweak-tool chromium-browser epiphany-browser openjdk-11-jdk vim nano flatpak exfat-utils libreoffice gnome-mpv gnome-backgrounds
flatpak remote-add --if-not-exists flathub
flatpak install flathub org.gnome.PasswordSafe

#only on dev
apt install polari gnome-builder golang fastboot heimdall-flash
snap install intellij-idea-community --classic
snap install code --classic
curl --proto '=https' --tlsv1.2 -sSf | sh

#qt dev on ubuntu gnome
apt install qtcreator qtbase5-dev qtwayland5 
apt install qt5-style-plugins libkf5style5 kde-style-qtcurve-qt5 kde-style-breeze qml-module-qtquick-controls-styles-breeze qml-module-org-kde-qqc2desktopstyle
apt install libqt5sql5-psql libqt5sql5-mysql
sudo echo "QT_QPA_PLATFORM=wayland" >> /etc/environment
#then reboot#

apt install libvirt-daemon virt-manager

Handle sudo



If needed, add user to group and then reset the root password

gpasswd -a mspehar sudo
sudo passwd -dl root

Reconfigure locales

dpkg-reconfigure locales

Change sources.list if needed

sed -i "s/" /etc/apt/sources.list

Change prompt for root

PS1="\[\033[01;31m\][\u@\h:\w]\\$\[\033[00m\] "
export EDITOR=vi

Add user to several groups

gpasswd -a mspehar sudo
gpasswd -a mspehar kvm
gpasswd -a mspehar libvirt

Remove snaps for gnome-apps

sudo snap remove gnome-system-monitor
sudo snap remove gnome-logs
sudo snap remove gnome-characters
sudo snap remove gnome-calculator

Disable few services

systemctl disable switcheroo-control.service
systemctl disable ModemManager.service

Fix idiotic handling of gnome wallpaper settings

rm -r ~/.cache/gnome-control-center/backgrounds
ln -s ~/Pictures/Wallpapers/ ~/.cache/gnome-control-center/backgrounds


Set red mount point

Handle netplan

  • if desktop/laptop, leave as is
  • if server
    renderer: networkd
    version: 2
            dhcp4: false
            addresses: []
                addresses: []

Change settings for journal in /etc/systemd/journald.conf


This can be done with the following statement

sed -i "s/^#Storage=auto/Storage=persistent/" /etc/systemd/journald.conf && systemctl restart systemd-journald

Disable overlay on ubuntu dock and animation for showing all apps (check previous post)

Disable ctrl-alt-d shortcut by changing “Hide all normal windows” to “Super-D”

This fixes opening “down” terminal in tilix.

Screenshot from 2019-04-27 13-41-20

Gnome boxes

If using gnome boxes, use the following pattern for adding remote machines


Change dock settings in ubuntu

Since dock doesn’t have enough options that can be toggled in gnome-settings, here is a way how to get around that.

List all the keys that can be changed:

gsettings list-keys | sort

The one i’m interested in is animate-show-apps and hotkeys-overlay, so read the values to verify:

gsettings get animate-show-apps
gsettings get hotkeys-overlay

Then change the values for both to false:

gsettings set animate-show-apps false
gsettings set hotkeys-overlay false


Mount NFS on linux using systemd to speed up boot

Using fstab to mount nfs shares is a bit slow. It depends on the NetworkManager-wait-online.service, so it waits 6s to do 200ms operation.

m@r7:~$ systemd-analyze blame | head -n 20
6.259s NetworkManager-wait-online.service
4.299s qemu-kvm.service
4.209s plymouth-quit-wait.service
745ms dev-nvme0n1p2.device
627ms snapd.service
580ms fwupd.service
537ms systemd-logind.service
329ms postfix@-.service
316ms mnt-f2.mount
313ms systemd-resolved.service
300ms snap-intellij\x2didea\x2dcommunity-106.mount
274ms udisks2.service
254ms systemd-timesyncd.service
251ms snap-gtk\x2dcommon\x2dthemes-818.mount
219ms snap-intellij\x2didea\x2dcommunity-101.mount
212ms snap-intellij\x2didea\x2dcommunity-109.mount
205ms upower.service
198ms mnt-red.mount
183ms snap-gnome\x2d3\x2d26\x2d1604-74.mount
169ms snap-gnome\x2d3\x2d26\x2d1604-70.mount

Sometime this wait is necessary, but in this case – not. In order to avoid this wait and actually proceed with boot, then mount whenever network becomes available, move mount definition from fstab to systemd.unit.

Unit (a file in /etc/systemd/system) should be named as dir-dir-dir.mount. So, if we are going to mount nfs share to /mnt/red, when we would call the unit file mnt-red.mount.

In my case, unit file /etc/systemd/system/mnt-red.mount looks like this:





After that, you just need to enable it with

systemctl enable mnt-red.mount

Voila, 6s boot time shaved off.



  • this wait of 6 seconds will still be there, mounting of nfs share is now not connected to fstab where root, home and other partitions are mounted from. it is done a bit later independently
  • it’s done on ubuntu 18.10