Important Command Lines for Ubuntu 20.04

Important Command Lines for Ubuntu 20.04

Ubuntu has seen one of the best releases in the last few years with version 20.04 and 20.04 LTS and it’s bringing new users to the platform. For that reason we prepared a quick guide to show you some of the important command line tools that are available in Ubuntu as well as other Debian based distros.

You can use this post as an Ubuntu CLI cheat sheet if you like, as we will be adding new commands regularly.

Sudo

Let’s start with one of the most popular commands: sudo is the quickest way to run something as a super user on a Linux environment. In this guide you will see that many commands must be run using sudo and the reason is that some of these commands can only be run as an administrator (or root user in the Linux world).

sudo apt install <package> will install a package as a super user.

sudo su Will open a shell as root. If you are looking to perform many ROOT level tasks, perhaps switching to the root user is a good idea.

sudo !! Useful to run the last command but now as root. If you wrote a long command but you forgot to run it as root this is a quick way to rerun it.

Apt

apt is one of the most popular cli tools available. It’s a system package manager that can keep the OS up to date and allows users to find and install new software. This can be considered the most important command line tool in Debian based systems.

Some of the most important commands are the following:

sudo apt update - Will update the manifest of all packages to learn if there are updates available.

sudo apt upgrade - Upgrades all packages installed in the system to their latest versions.

apt search <name> - Searches for packages containing the word provided under .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ivan@ubuntu:~$ apt search tilix
Sorting... Done
Full Text Search... Done
budgie-desktop-environment/focal,focal 0.13.7 all
Desktop environment customisation for Ubuntu Budgie

gnome-shell-extension-tilix-dropdown/focal,focal 7-1 all
launch tilix in quake-mode from gnome-shell

gnome-shell-extension-tilix-shortcut/focal,focal 1.0.1-2 all
Adds easy to use configurable keyboard shortcut for tilix

tilix/focal,now 1.9.3-4build3 amd64 [installed]
Tiling terminal emulator for GNOME

tilix-common/focal,focal,now 1.9.3-4build3 all [installed,automatic]
Tiling terminal emulator - data files

Snap

Snap is a software deployment and package manager built by Canonical, the same company behind Ubuntu. You can install Snap on Debian distros by running sudo apt install snapd. Once installed you can use Snap in a similar way than Apt.

snap find <name> - Will look for packages that match the name field.

sudo snap install <name> - Will install the provided package.

sudo snap refresh - Will update installed packages.

sudo snap refresh --list

Aptitude

Aptitude is an Ncurses based UI for installing packages on a Debian based system. Think about this as the console GUI for apt. It can be installed by running sudo apt install aptitude and the commands are very similar to the ones in apt.

aptitude will launch Aptitude GUI.

aptitude install <name> will install a package.

aptitude search emacs will search for a package.

Ufw

UFW is the tool for managing Ubuntu’s firewall.

sudo ufw deny from 14.23.23.23 Will block connections from the specified IP

sudo ufw allow 443 Will allow connections to the system on port 443 (https)

sudo ufw status Will show the current status (enabled|disabled)

Htop

Htop is a console visual representation of the system monitor. It shows processes running as well as memory, cpu and disk usage. It can be customized and sorted in many ways and it’s normally one of the first utilities installed by power users.

mc

Midnight Commander is a visual file manager for the console and it’s based on Ncurses (like Aptitude). Installing it is as simple as doing sudo apt install mc.

The interface will show two panels where you can move/copy files from and to as well as many other fuctions. Definitely a great tool if you have no access to a desktop environment.

More to come

Keep an eye on this guide as we will be adding more commands to help new users get familiar with the console and CLI tools.

Tags: ubuntu

More Content