Linux important commands

Apt update vs Apt upgrade: What's the difference?

What does apt update do?
"apt update" updates the package sources list with the latest versions of the packages in the repositories.

Package sources list contains the locations or URLs of some of the repositories from which a package is installed.

You can view this list using the command :
cat /etc/apt/sources.list

What does apt upgrade do then?
"apt upgrade" compares the version of all the packages currently installed on the system with the ones in the list we fetched through apt update and upgrades all of them to their latest versions.

Generally, when upgrading all the packages in the system, we merge both apt update and apt upgrade commands in a single line:
sudo apt update && sudo apt upgrade
All these things happen in the backend within a few seconds.

Install the software in Kali Linux using apt-get install command
Installing extra software packages by apt-get command is simple and straightforward.

Syntax :
sudo apt-get install {package_name}
For example, if you want to install the gimp package
apt-get install gimp

How to Remove/Uninstall software in Kali Linux: apt-get remove
Apt-get can work as remove packages, if packages are not useful anymore then it can be remove by using following Syntax

sudo apt-get remove {package_name}

Auto Remove: apt-get autoremove
At the time of upgrading distribution the Operating System’s software packages are replaced by new and improved version. The auto remove function will remove old version package no longer needed for functionality of system. Syntax

sudo apt-get autoremove
It should be perform after upgrade or distribution upgrade.

Purge (Erase packages): apt-get purge 
This function will erase software packages completely with related configuration files in one fell swoop. It is dangerous when used incorrectly or by mistakes. So use remove for uninstalling software packages. Purge can be used by the following syntax:

sudo apt-get purge {package_name}

Clean downloaded packages : apt-get clean 
Packages are downloaded from the source in the system, unpackaged, then installed on system. Package will reside on the system, which are no longer necessary after installation of package. These packages consume the memory and need to be cleaned away. Use following command and launch clean function :

sudo apt-get clean

Putting two or more function together :
Syntax:

apt-get update && apt-get upgrade && apt-get dist-upgrade

apt-get autoremove && apt-get autoclean

Ifconfig
ifconfig(interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning. Also, this command is used to assign the IP address and netmask to an interface or to enable or disable a given interface.

Help command 
The help command is the simplest way to get information regarding a built-in shell command. It helps you fetch information from the shell’s internal documentation.



Comments