Skip to main content

Commands

Extend partition size

    1. Get PV (Physical Volume) name (Ex: /dev/sda1)
      sudo pvs
    2. Resize the PV
      sudo pvresize /dev/sda1
    3. Get root logical volume name (Filesystem value of / row; for example: /dev/mapper/ubuntu--vg-root)
      df -h
    4. Expand logical volume
      sudo lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-root

Source:

Create sudo user

  1. First create the user: adduser sammy
  2. Add user to the sudo group: usermod -aG sudo sammy
  3. Then either logout and log back in, or switch to the user: su - sammy

Source:

Replace text using sed

  • sed -i 's/FIND_TEXT/REPLACE_TEXT/' file.txt