list timezone | timedatectl list-timezones |
set new timezone | sudo timedatectl set-timezone Europe/Paris |
update hostname | sudo hostnamectl set-hostname [new_name] |
add static ip with Netplan | sudo vim /etc/netplan/01-cfg-ens19.yaml network: ethernets: ens19: addresses: - 172.16.0.1/12 version: 2 sudo chmod 600 /etc/netplan/* sudo netplan apply |
lists network interfaces with NetworkManager | nmcli connection show NAME UUID TYPE DEVICE WiFi5 79361210-59bd-4a91-a4af-c78634446295 wifi wlp2s0
|
rename Interface with NetworkManager | nmcli connection modify “Wired connection 1” connection.interface-name “ens19” |
add static IP with NetworkManager | nmcli con mod <NET_UUID> ipv4.address 192.168.1.2/24 nmcli con mod <NET_UUID> ipv4.gateway 192.168.1.1 nmcli con mod <NET_UUID> ipv4.method manual nmcli con mod <NET_UUID> ipv4.dns 8.8.8.8 nmcli con mod <NET_UUID> autoconnect yes nmcli con down <NET_UUID> nmcli con up <NET_UUID> |
display file permission and ownership | ls -alrt -rwxrwxr–. 1 ansible automation 4 Nov 13 10:57 helloworld.txt
r = read = 4 w = write = 2 x = execute = 1 [ user = u ] [ group = g ] [ others = o ] The user ansible has 4+2+1=7 (full access) The group automation has 4+2+1=7 (full access) All others have 4 (read-only) |
change permission file or directory | chmod 644 myfile |
change user and group appartenance | chown -R user:group /mydirectory/ |
list nvme disk | $ sudo fdisk -l /dev/nvme* |
Extend physical drive partition | # check free space sudo fdisk -l # Extend physical drive partition sudo growpart /dev/sda 3 # See phisical drive sudo pvdisplay # Instruct LVM that disk size has changed sudo pvresize /dev/sda3 |
resize logical volume | # View starting LV sudo lvdisplay # Resize LV sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv df -h #Resize Filesystem sudo resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv |
Create partition for New Disk | fdisk /dev/sdc Command (m for help): n and enter Command (m for help): w |
format the disk with mkfs command | mkfs.ext4 /dev/xvdc1 |
share file with windows | sudo apt-get install samba sudo smbpasswd -a denis sudo vim /etc/samba/smb.conf [data] path = [folder_to_share] valid users = [user] read only = no # guest ok = yes # no auth sudo systemctl restart smbd sudo systemctl enable smbd |
add permanent dummy virtual interface | $ cd /etc/systemd/network/ $ sudo touch vbr0.netdev vbr0.network
$ sudo vim vbr0.netdev [NetDev] Name=vbr0 Kind=dummy
$ vim vbr0.network [Match] Name=vbr0 [Network] Address=172.16.0.249 Mask=255.240.0.0 Broadcast=172.31.255.255
$ sudo systemctl restart systemd-networkd $ sudo systemctl enable systemd-networkd |