Important Uses
On Ubuntu Server 20.04 LTS
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.
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
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.
Create and extract
tar
archive files
tar -xvzf psp_docs.tar.gz
In the above uses, tar
collected all the files into one package, psp_docs.tar
. The gzip program applied compression, hence the gz
extension. So the command does a couple things:
f
: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.z
: tells tar to decompress the archive using gzipx
: tar can collect files or extract them.x
does the latter.v
: makes tar talk a lot. Verbose output shows you all the files being extracted.
To extract into a custom folder, add the -C
option with a folder name of your choice:
tar -xvzf psp_docs.tar.gz -C some_custom_folder_name
Type man tar
for more information.
Last updated