os linux

Ubuntu

Apt

List installed packages

dpkg -l

List installed files

dpkg -L <package-name>

Search a package

apt-cache search <pattern>

Login

Prevent suspend when laptop closed

cat /etc/systemd/logind.conf
[Login]
HandleLidSwitch=ignore

Installer

Snap

It is well integrated with ubuntu. Sometimes flatpak is more up-to-date but snap has the advantage to provide a command in the path.

Also, snap does not access to /tmp folder, which can be problematic.

Flatpak

Flatpak is as good as snap, with a different software coverage, but it does not provide a command in the path: instead flatpak run <tool>.

Also the sofware are installed by package name flatpak install flathub org.gimp.GIMP

Dark Mode

Gtk natives

cat .gtkrc-2.0
gtk-application-prefer-dark-theme=true
gtk-key-theme-name = "Emacs"
gtk-icon-theme-name = "Yaru-dark"

18:46 $ cat .config/gtk-3.0/settings.ini
[Settings]
gtk-application-prefer-dark-theme=true
gtk-key-theme-name = emacs
gtk-icon-theme-name = "Yaru-dark"
gtk-can-change-accels = 1

Gtk flatpak

see flatpak overrides

sudo apt install ubuntu-session yaru-theme-gnome-shell yaru-theme-gtk yaru-theme-icon yaru-theme-sound
ln -s /usr/share/themes ~/.themes
sudo flatpak override  --filesystem=$HOME/.themes
sudo flatpak override --env=GTK_THEME=Yaru-dark

Limit resource to program

# 10000 / 200000 = 0.05 == 5% CPU usage cap.
echo 10000 > /sys/fs/cgroup/cpu/cpulimited/cpu.cfs_quota_us
echo 200000 > /sys/fs/cgroup/cpu/cpulimited/cpu.cfs_period_us
# bash script
sudo cgexec -g cpu:cpulimited ./your_program_or_script.sh
# existing program
cgclassify -g cpu:cpulimited <pidNum>

see cgroup

Ignore poweroff button press

  1. Open the file /etc/systemd/logind.conf:
sudo vim /etc/systemd/logind.conf
  1. Find the line that starts with HandlePowerKey= and change its value from poweroff to ignore. If the line is commented out, uncomment it and change its value.
HandlePowerKey=ignore

React ?

This page was last modified: