# Commands

#### Extend partition size

<p class="callout info">If the partition size was changed in Proxmox, then after the resize on the UI, restart the VM</p>

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


Source:

- [Can't resize a partition using resize2fs](https://unix.stackexchange.com/questions/138090/cant-resize-a-partition-using-resize2fs)

#### Create sudo user  


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

Source:

- [How To Create A New Sudo Enabled User on Ubuntu 22.04](https://www.digitalocean.com/community/tutorials/how-to-create-a-new-sudo-enabled-user-on-ubuntu-22-04-quickstart)

#### Replace text using sed

- ```shell
    sed -i 's/FIND_TEXT/REPLACE_TEXT/' file.txt
    ```