Important Uses

On Ubuntu Server 20.04 LTS

  1. Install updates via command line

sudo apt update        # Fetches the list of available updates
sudo apt upgrade       # Installs some updates; does not remove packages
sudo apt autoremove    # Removes any old packages that are no longer needed. This also removes older kernels. Only latest two are kept.
  1. Usage "autoclean", "autoremove" and "clean"

From the apt-get man page:

  • clean: clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When APT is used as a dselect(1) method, clean is run automatically. Those who do not use dselect will likely want to run apt-get clean from time to time to free up disk space.

  • autoclean: Like clean, autoclean clears out the local repository of retrieved package files. The difference is that it only removes package files that can no longer be downloaded, and are largely useless. This allows a cache to be maintained over a long period without it growing out of control. The configuration option APT::Clean-Installed will prevent installed packages from being erased if it is set to off.

  • autoremove: is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no longer needed.

Every command has a manual page, if you want to know what their parameters are or what each of them do, just type in the shell `man ` Ex. `man apt-get

manpage for the apt-get command

3. How to uninstall or remove <installed-application> software package from Ubuntu server.

You can uninstall or removes any installed software package itself from Ubuntu server through the terminal. Let us uninstall grub-common software packages from our system.

$ sudo apt-get remove grub-common

Uninstall grub-common including dependent package

If you would like to remove grub-common and it's dependent packages which are no longer needed from Ubuntu

$ sudo apt-get remove --auto-remove grub-common 

Use purging grub-common

If you use with purge options to grub-common package all the configuration and dependent packages will be removed

$ sudo apt-get purge grub-common 

If you use purge options along with auto remove, will be removed everything regarding the package, It's really useful when you want to reinstall again

$ sudo apt-get purge --auto-remove grub-common 
  1. Remove update link error - Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings.

sudo truncate -s 0 /var/lib/ubuntu-release-upgrader/release-upgrade-available

5. Scroll/Navigate on ubuntu server

ls -l | less

The bar in the middle of the two commands is called the “pipe” which is the character option above the \ character on US keyboards. So in essence, you are taking the output of ls -l and piping it into the pager program on Linux called less or try more if less is not found. less will take all of the output from ls -l and present it to you one page at a time.

Last updated