Skip to content

Instantly share code, notes, and snippets.

@txhammer68
Last active May 17, 2024 03:23
Show Gist options
  • Save txhammer68/487164d7e59df958bf41a12178dacd12 to your computer and use it in GitHub Desktop.
Save txhammer68/487164d7e59df958bf41a12178dacd12 to your computer and use it in GitHub Desktop.
Linux Tips

Linux Tips (Debian Based distros)

Some usefull tips i have collected over the years, use at own risk.

  • Users & Groups

    • Add user to group
      sudo usermod -a -G cdrom userName
      sudo usermod -aG vboxsf $USER
  • Change root password
    sudo passwd root

  • Analyze Boot Times
    systemd-analyze critical-chain
    systemd-analyze blame
    systemd-analyze --user blame

  • View journal logs

    • Complete log - journalctl --since today
    • Errors only - journalctl -p 2 --since today
    • Warnings Only - journalctl -p 4 --since today
  • View SSD/HDD IO performance
    List drives lsblk -f
    Calculate IO for device sudo hdparm -t /dev/sda2
    Calculate w/ no buffers/cache sudo hdparm -t --direct /dev/sda

  • Clear bash history
    history -c

  • Restart network
    sudo systemctl restart NetworkManager.service
    sudo systemctl restart network

  • Network traffic
    sudo nethogs -d 2

  • Clear font cache
    fc-cache -f -v

  • Create iso image
    dd if=/dev/cdrom of=~/cdrom_image.iso

  • Create backup image of entire disk
    Change /dev/sda to your device for backup -
    dd if=/dev/sda conv=sync,noerror status=progress | gzip -c > /Data/backupImage12-23.image.gz

  • Restore image to a disk gunzip -c /Data/backupImage12-23.image.gz | dd of=/dev/sda

  • Simple python webserver, run in folder of website
    python3 -m http.server 8000 /www/website/
    access w/ http://localhost:8000

  • Remove python managed restrictions
    sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED

  • apt hold package back from upgrades...
    sudo apt-mark hold packageName
    Verify sudo apt-mark showhold
    Remove sudo apt-mark unhold packageName

KDE Plasma 5 Tips & Tricks

  • General rules for plasma bugs/issues

    • Go back to basic Plasma Breeze Themes to verify if issue is w/ Plasma or theme you installed
    • Remove last installed plasmoid/widget, some cause memory leaks or unexpected issues
    • Wayland is still being developed, many apps do not work well with wayland or unexepected results,
      revert back to X11 session to verify.
  • Wayland icons

    • Qt 5, create window rule using .desktop application name
    • Python Create/Locate matching .desktop entry in $HOME/.local/share/applications
      add to main python - app.setDesktopFileName("$HOME/.local/share/applications/appName")
  • Restart Plasma 5 Desktop X11
    kbuildsycoca5 && kquitapp5 plasmashell && kstart5 plasmashell && kwin_x11 --replace &

  • Clean dolphin search indexes
    balooctl disable && balooctl purge && balooctl enable && balooctl check

  • Clean KDE cache

    • Icons and themes rm $HOME/.config/*.kcache
    • Plasmashell rm -r $HOME/.config/plasmashell
    • Remove everthing rm -r $HOME/.cache
    • Logout after cleaning
  • Minimize Qt logging
    Add to /etc/environment - QT_LOGGING_RULES=*.debug=false;qt.*.debug=false;qt5.debug=false;*.warning=false;*.critical=false

  • KDE debugging settings
    kdebugdialog5

  • Screen locker borked
    loginctl unlock-sessions

  • To set presentation mode, prevent sleep mode, screen saver
    inhibit_cookie=$(qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.Inhibit 'yt-dlp' 'downloading')

  • To unset presentation mode
    qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.UnInhibit $inhibit_cookie

@josebaezmedina
Copy link

This awesome, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment