How Do I Update Linux Software On Ubuntu From Command Line?

Use this:

sudo apt update        # Fetches the list of available updates
sudo apt upgrade       # Installs some updates; does not remove packages
sudo apt full-upgrade  # Installs updates; may also remove some packages, if needed
sudo apt autoremove    # Removes any old packages that are no longer needed

Documentation about each apt option can be found in the the manpages for apt. These are also available by running man apt in your terminal.

Use of both upgrade and full-upgrade together is usually not needed, but it may help in some cases: see Debian documentation about Upgrades from Debian 9.


nmap on Ubuntu

Installing nmap on Ubuntu

In order to install nmap on Ubuntu, we will be using these commands at terminal:

$ sudo apt-get install nmap

Simple Scanning With nmap on Ubuntu

In terminal of your choosing, type(you should use your own ip address or ip address of network you wish to scan):

$ sudo nmap -sn

Whatever ip address you have must be followed by ‘/24’. It also helps to change last number to ‘0’. That will give us first possible ip address on that network. Using ‘/24’ informs our computer to scan from ip address ‘’ until it reaches and scans ‘’.

Diving Deeper Scanning With nmap on Ubuntu

If we remove our ‘-sn’ option, we can use nmap to scan ports on all of those devices we found above.


$ sudo nmap

Aggressively Scanning With nmap On Ubuntu

$ sudo nmap -A -T4

In this line of code, ‘-A’ option acts as an aggressive scan. This runs nmap’s operating system detection, version detection, script scanning, and traceroute detection.

There is a timing template set by ‘-T’ flag. From 0 to 5, we can chose to run nmap in one of these timing modes. Each timing mode is interestingly named:

  • (0) Paranoid
  • (1) Sneaky
  • (2) Polite
  • (3) Normal
  • (4) Agressive
  • (5) Insane


Uninstall A Package Via Command Line On Ubuntu Linux

Use one of these codes here to get a list of all the packages on your device.

$ apt --installed
$ dpkg -l

Once you have found that program, use apt or one of these commands to remove it.

$ sudo apt remove package-name
$ sudo apt-get remove package-name
$ sudo dpkg -r package-name

Any of the above commands will remove the specified package, but they will leave behind configuration files, and in some cases, other files that were associated with the package. To remove those as well, you need to “purge” the package. You can do this either after removing a package or instead of removing a package (purging automatically implies removing as well).

$ sudo apt purge package-name
$ sudo apt-get purge package-name
$ sudo dpkg -P package-name