Ubuntu Cheats sheet.

1. Remove a package:

Get the package complete name:

# dpkg --list | grep partial_package_name*
# apt list --installed

Remove the package:

# sudo apt-get remove package_name

Remove all the dependencies:

# sudo apt-get purge package_name

Remove the unneeded packages that were once installed as a dependency:

# sudo apt-get autoremove

Remove the retrieved packages from the local cache:

# sudo apt-get autoclean

Check that it was completely removed:

# dpkg --list | grep partial_package_name*

2. Remove a Snap:

Using remove command:

# sudo snap remove package_name

3. Search package available 

# apt search nfs-util


4. To exclude a package from being upgraded:
Mark the package as held:

# apt-mark hold package_name

Verify that the package is held:

# dpkg --get-selections | grep "hold"

Upgrade all other packages:

# apt upgrade

To unhold a package and allow it to be upgraded:
Mark the package as unheld:

# apt-mark unhold package_name

Upgrade all packages:

# apt upgrade

5.  Add  extra IP-ADDRESS to same interface.

Check the ip-address.
root@ans01:~# ip r
default via 192.168.2.1 dev ens160 proto static
192.168.2.0/24 dev ens160 proto kernel scope link src 192.168.2.223

Add new ip-address (172.16.1.223)
root@ans01:~# cat /etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        ens160:
            addresses:
            - 192.168.2.223/24
            - 172.16.1.223/16
            gateway4: 192.168.2.1
            nameservers:
                addresses:
                - 192.168.2.1
    version: 2

Applying a netplan configuration
root@ans01:~# netplan apply

6. Add  extra IP-ADDRESS to different interface.

Check the ip-address.
root@ans01:~# ip r
default via 192.168.2.1 dev ens160 proto static
192.168.2.0/24 dev ens160 proto kernel scope link src 192.168.2.223

Add new ip-address (172.16.1.223)
root@ans01:~# cat /etc/netplan/50-cloud-init.yaml
network:
    version: 2
    ethernets:
        ens160:
            addresses:
            - 192.168.2.223/24
            gateway4: 192.168.2.1
            nameservers:
                addresses:
                - 192.168.2.1
        ens192:
            addresses:
            - 172.16.1.223/16

Applying a netplan configuration
root@ans01:~# netplan apply
Testing a netplan configuration root@ans01:~# netplan try root@ans01:~# netplan --debug generate

No comments:

Post a Comment