How to update Kali Linux to the latest version using 1 line of command code
Before updating the Kali Linux operating system, make sure you are logged in as a root user. The default username and password for the root user in Kali Linux are as follows:
username : root
password : toor
This is the default repository in Kali Linux (/etc/apt/sources.list):
deb https://http.kali.org/kali kali-rolling main non-free contrib
deb-src https://http.kali.org/kali kali-rolling main non-free contrib
You must install gnupg to use the mirror repository:
apt install gnupg2
wget https://archive.kali.org/archive-key.asc -O /etc/apt/trusted.gpg.d/kali-archive-key.asc
Please back up the default repository with the following command:
mv /etc/apt/sources.list /etc/apt/sources.list.backup
Internet connection on the default repository server on Kali Linux is quite slow. You can replace it with the repository server below or use another mirror server to get a faster connection:
echo "deb https://mirrors.ocf.berkeley.edu/kali/ kali-rolling main non-free contrib"$'\r'"deb-src https://mirrors.ocf.berkeley.edu/kali/ kali-rolling main non-free contrib" > /etc/apt/sources.list
You can update and upgrade the Kali Linux operating system using the following command (make sure you are logged in as root or sudo):
apt update -y && apt upgrade -y && apt dist-upgrade -y && apt full-upgrade -y && apt autoremove -y
You can copy the command code above and press CTRL+SHIFT+V to paste it directly into the linux terminal.
update is used to update repositories and list of packages.
upgrade & dist-upgrade is used to update packages.
full-upgrade is used to update the Kali Linux version.
autoremove is used to delete packages that are no longer required.
You can check the Kali Linux version using the following command:
cat /etc/os-release
enjoy :)