Regular Updates and Cleaning Kali Linux SystemKali Linux is a rolling distribution which means all aspects of the operating system, including the Linux Kernel, the desktop environment, all utilities, and all applications, are updated on a regular basis. As a result, we must update it on a regular basis in order to stay updated always. Not only that, some old packages of the application are kept as junk on our system due to regular updates. Although these older files are not malicious, they may cause our system to slow down. As a result, we must clean them regularly. Updating and Upgrading Kali LinuxWe can perform many types of updates, such as a standard update, a full upgrade, and a distribution upgrade. Updating Kali LinuxThe following command can be used to update our system: The above command will update the package list of upgrades, as well as new packages that have recently been added to the Kali Linux repositories. As we can see in the screenshot below: In the above screenshot, we can see that our system has already been updated. we have to keep in mind that this only updates the list of available packages and their versions, not installing or upgrading any of them. We can actually use the upgrade to install them. Upgrading Kali LinuxWhere update updates the list of available packages but does not install them, upgrade actually installs newer versions of the packages. The package manager will know about available updates for the software we have installed after we have updated the lists. As a result, before upgrading, we must run update. In order to upgrade the Kali Linux, we have to run the following command on our Kali Linux terminal: We can see in the above screenshot that the upgrade is running. It might take some time depending on our system performance and internet connection. Unlike Windows, we can cancel it anytime and start it again by applying the same command. Whereas the sudo apt upgrade -y command installs all packages without removing any and skips upgrading old packages if removal is required, sudo apt full-upgrade -y command removes old packages if necessary to upgrade packages to their most recent versions. The output of the above command is display in the below screenshot: Although sudo apt full-upgrade can be used after sudo apt update-y command, but sudo apt update -y thought to be safer than sudo apt full-upgrade -y. But do not worry, it won't cause much damage to our system. The sudo apt-get dist-upgrade command upgrades the packages in the same way as the sudo apt-get upgrade does. It also, take care of changing dependencies with the most recent versions of the package. It wisely resolves package dependency conflicts, and if necessary, tries to upgrade the most vital packages at the expense of less important ones. Unlike the sudo apt-get upgrade command, the sudo apt-get dist-upgrade is proactive, installing new packages or removing existing ones on its own to complete the upgrade. With the help of the above command, we can upgrade our distribution completely. Cleaning Kali LinuxUsing the command below on our Kali Linux terminal, we can clean up the packages we don't need much. The output of the above command, we can see in the below screenshot: This command is safe to use and should not create any issues. Each program update, package files are downloaded to the package cache. After the update, downloaded files (also known as installation files) are not deleted, and the package cache progressively grows too large sizes. This was done purposely with the concept that if the new package has problems after the next update and the old version is no longer available in the online repository; we can revert to the old version by installing it from a file saved in the package cache. The cache expands quite quickly for rolling distributions. If we do not have the necessary skills to roll back to the previous version utilizing the installation package that is stored in the cache. Then for us, these hundreds of megabytes or numerous gigabytes are a waste of space on our hard drive. As a result, we can run the following commands: The sudo apt clean -y command cleans the local repository from the package files we received. It deletes everything except the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. Sudo apt autoclean -y cleans downloaded package files from the local repository, just like sudo apt clean -y. There is only one difference; it simply deletes package files that are no longer available for download and are essentially ineffective. This helps us to keep the cache for a long time without growing more. The following command is not directly related to the cleaning; however, it helps maintain our Kali Linux system health. The -f or -fix broken, flag attempts to normalize a system by repairing broken dependencies. We used this option with install/remove and can omit any package to allow APT in order to find possible solutions. If the packages are listed, this should solve the problem completely. |