Linux :: System

System

Kernel

kernel-install # add and remove kernel and initramfs to and from /boot
mkinitcpio -p linux # generate initramfs img file
uname -r # list kernel version; -a list all information

Process

top
ps aux | grep ssh

who -u # list all logged in session with PID
last # last log in information

Disk

df # usage
du -hs # -h human readable; -s single dir
du -h --max-depth=1 | sort -h # sort by size
fdisk -l
ncdu
lsblk -f
blkid # get UUID or PARTUUID information
tune2fs -O "^has_journal" /dev/sdXN # disable journaling

Battery

upower -e
upower -d
upower -i /path/to/info
acpi -V

Hardware Information

dmidecode # BIOS information
lshw
lscpu
lsusb
lspci
lsscsi

Udev

systemd-udevd.service

# rules
/etc/udev/rules.d/
/usr/lib/udev/rules.d/  # rules shipped with packages

# USB autosuspend
/etc/udev/rules.d/50-usb-power_save.rules
# auto: auto suspend; no: no suspend; use lsusb to find ID
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{idVendor}=="05c6", ATTR{idProduct}=="9205", ATTR{power/control}="auto"

udisks

udisksctl mount -b /dev/sdc1
udisksctl unmount -b /dev/sdc1
# polkit action
org.freedesktop.udisks2.filesystem-mount

SSD Maintainence

lsblk --discard # check TRIM support
systemctl enable fstrim.timer # once a week 
# config file at /usr/lib/systemd/system/fstrim.timer

blkdiscard /dev/sdX # Trim an entire device will erase all data

smartctl --all /dev/sda # require pkg smartmontools