Upgrade from Ubuntu 16 or 17 to 18

First, we need to run the following command to change all instances of yakkety to bionic in the source list file (/etc/apt/sources.list). The former is the code name for Ubuntu 16.10, whereas bionic is the code name for Ubuntu 18.04.

sudo sed -i ‘s/yakkety/bionic/g’ /etc/apt/sources.list

If you are using Ubuntu 17.04, then run this command instead:

sudo sed -i ‘s/zesty/bionic/g’ /etc/apt/sources.list

Then we need to disable third-party repositories (PPAs) with the command below:

sudo sed -i ‘s/^/#/’ /etc/apt/sources.list.d/*.list

After that, update software sources and upgrade software to the latest version available in the Ubuntu 18.04 repository. This step is called minimal upgrade:

sudo apt update

sudo apt upgrade

Once minimal upgrade is finished, run the following command to begin full upgrade:

sudo apt dist-upgrade

Install Ubuntu Server Desktop UI

Install xrdp

Install the xfce4 desktop session:
$echo xfce4-session > ~/.xsession

Authentication is required to create a color profile

Add Filename: /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

polkit.addRule(function(action, subject) {
if ((action.id == “org.freedesktop.color-manager.create-device” ||
action.id == “org.freedesktop.color-manager.create-profile” ||
action.id == “org.freedesktop.color-manager.delete-device” ||
action.id == “org.freedesktop.color-manager.delete-profile” ||
action.id == “org.freedesktop.color-manager.modify-device” ||
action.id == “org.freedesktop.color-manager.modify-profile”
) && (
return polkit.Result.YES;

umount home/rma/thinclient before delete his home directory
$sudo umount $HOME/thinclient_drives

Uninstall Ubuntu Desktop
#apt-get remove ubuntu-desktop (or purge)

#apt-get remove gnome-shell (or purge)

0. enter the super user shell
sudo -i

Check open ports
nmap external IP address
1. Firewall ufw (refer to the pdf for more details)
2. ufw enable
3. ufw allow 25/tcp

root@ubuntu:~# ufw status numbered
Status: active

To Action From
— —— —-
[ 1] 80 ALLOW IN Anywhere
[ 2] 80/tcp DENY IN
[ 3] 80/tcp DENY IN
[ 4] 80/tcp DENY IN
[ 5] 80/tcp DENY IN

3. deluser, delgroup (userdel, groupdel, low-level utilities)

4. Find users and groups
cat /etc/passwd
cat /etc/group

5. usermod (Modify user account)
usermod -g (change primary group)
usermod -G (change secondary group)
usermod ©\d /srv/files/ftp ftp (change home directory)

6 Check status of services
service –status-all

7. nano search: contro+w, find next: alt+w

8. check which group a user belongs to
groups mji

9. ‘top’ show information like tasks, memory, cpu and swap. Press ‘q‘ to quit window.

10. check performance – others
iotop (showing I/O on the system)
netstat -t (showing connections)
Take a look at the apache logfiles and find out what the server did last
set some RLimits for the apache process. When these limits are reached the process will be killed, giving you some more information

11. List installed packages
apt list –installed

12. dig google.com – find out the A record of a domain

13. Search for a string in all the files in a directory
example: grep -r “mydomain.com” /etc/apache2/

14. Check open ports
netstat -anltp | grep “LISTEN”

15.  Search for exact word
grep minda -r, grep -w “minda” -r

16. Using tar to compress a directory or file
$tar -czvf archive.tar.gz stuff (stuff is a folder in the current directory)

-c: Create an archive.
-z: Compress the archive with gzip.
-v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
-f: Allows you to specify the filename of the archive.
-p: preserve the permissions

$tar -xzvf archive.tar.gz (same, but use ‘x’ instead of ‘c’)

16. curl vs Wget
curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

wget command is used to download files from networks such as the internet.

Examples of using “curl”

Ubuntu Repositories

Ubuntu Basics 2