2022년 2월 2일 수요일

Linux System Management

 # Avoid clicking sound from hdd
$ hdparm -B 254 -S 241 /dev/sda
## /etc/hdparm.conf
/dev/sda {
    apm = 254
    apm_battery = 254
    spindown_time = 241
}

# Grub screen resolution
## /etc/default/grub
uncomment as GRUB_GFXMODE=800x600
$ update-grub

# Keyboard remapping; capslock into ctrl, and swap Left Window with Left Alt
## Check available options
$ grep alt /usr/share/X11/xkb/rules/evdev.lst | grep win
## /etc/default/keyboard
XKBOPTIONS="ctrl:nocaps, altwin:swap_lalt_lwin"

# Install vscode
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
$ sudo apt install code

# Install emacs
$ sudo apt install emacs-nox
## emacs goodies
$ apt install elpa-irony elpa-flycheck elpa-ggtags

# Install KeePassXC, Gaculator, Visual Studio Code, LimeSuite GUI, Meld, QtCreator, Sublime Text, Spinnaker, FreeCad, GIMP, ImageJ, LibreCad, Shotwell, Meshlab, Chromeium, Firefox, ThunderBird, Skype, Remote Viewer, Telegram, Kicad, Fish, Disk Usage Analyzer, GParted, CuteCom, libvirt, Vitual Machine Viewer, Barrier,

# Install LibreOffice
Prof-XFCE-theme-1.2, Papirus-Light,

pycharm,


# Delete APT cache
$ apt autoclean

# Delete unneccessary APT packages
$ apt autoremove

# Delete systemd journal logs
$ journalctl --disk-usage
$ journalctl --vacuum-time=3d

# Delete log files
$ rm -v /var/log/*log*

# Analyze booting process in terms of time cosuming
$ systemd-analyze blame
## In case of too long consuming service
$ systemctrl disable $(service_name)

# Disabling tracker for your user only
Enter the directory ~/.config/autostart, create it if it does not exist
Create a file named tracker-miner-fs-3.desktop
Paste the following into the file, save and exit:
[Desktop Entry]
Encoding=UTF-8
Name=Tracker
Hidden=true

or

$ systemctl --user unmask tracker-store.service tracker-miner-fs-3.service tracker-miner-rss.service tracker-extract-3.service tracker-miner-apps.service tracker-writeback.service


# Error starting domain: Requested operation is not valid: network 'default' is not active
Type help for instructions on how to use fish
$ virsh net-list --all
 Name      State      Autostart   Persistent
----------------------------------------------
 default   inactive   no          yes

$ virsh net-start default
Network default started

$ virsh net-autostart --network default
Network default marked as autostarted

# find the UUID of disk
$ blkid | grep UUID

# Clone disk
$ dd if=/dev/sda of=/dev/sdb bs=4096 conv=noerror,sync

# Firmware update
$ fwupdmgr get-devices
$ fwupdmgr refresh
$ fwupdmgr update