about

I'm Linyi, and welcome to my personal blog. I live in the beautiful city of Montreal, where I spend my time exploring my passions for software development, outdoor adventures, and sharing knowledge.

Linux Cheatsheet

Published at 1/5/2025 12:00:00 AM

Linux commands

How to mount a drive

qm unlock "vm id"
umount /mnt/pve/"mount name"

lsblk -f
/etc/fstab

UUID=063c75bc-bcc6-4fa5-8417-a7987a26dccb /mnt/backups ext4 defaults,noatime,nofail 0 2
mount -a

How to install updates

sudo apt update        # Fetches the list of available updates
sudo apt upgrade       # Installs some updates; does not remove packages
sudo apt full-upgrade  # Installs updates; may also remove some packages, if needed
sudo apt autoremove    # Removes any old packages that are no longer needed

How to remove a directory with content

rm -rf

Set up git username and email

git config --global user.name "FIRST_NAME LAST_NAME"
git config --global user.email "[email protected]"

How to resize ubuntu partition?

  1. use live CD and resize in Gparted
  2. enter the system.
sudo lvextend -l 100%VG ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

How to auto update ubuntu?

sudo dpkg-reconfigure -plow unattended-upgrades
sudo systemctl restart unattended-upgrades
which unattended-upgrades