IMAT5122 – Computer Systems and Networks
Laboratory Session 3:
Introduction to GNU / Linux and its shell
Please launch the UbuntuVM.
Task A) Welcome to GNU/Linux (Ubuntu) Have a look around…
Task B) Press the top left button (symbol: ). You can now search for programs,
pictures, music, references, the web etc. by typing in text. Now type “Firefox” and
click its icon (symbol ) to start that browser application. Firefox will start and
you can browse the web as with any other typical modern Operating System. Now
try running and using a few other applications such as LibreOffice, SystemMonitor,
Mahjongg, Files, and others.
Task C) Press the top left icon again and type in “Terminal”. Click on the Terminal program
to open it. Does this look familiar?
This is the GNU/Linux equivalent of the Windows Command Line window we
explored last week. Instead of opening a terminal window, you can also switch away
from the GNOME GUI Desktop view to an actual terminal by simultaneously
pressing the keyboard buttons [CTRL] + [ALT] + [F1]. You can get additional
terminal windows by replacing the [F1] with another F key (e.g. F2, F3, …). To get
back to the GUI / desktop please press [CTRL] + [ALT] + [F7] (for some of the lab
computers this might be another F-key such as F8 or F9).
Task D) Now let’s have a look at some key differences between the Windows and
GNU/Linux command line:
Different characters in paths (Windows’ backslash “\” versus others’ slash “/”):
In Windows you would use e.g. “notepad C:\User\test.txt”
In GNU/Linux (& Mac OS X) you would use e.g. “notepad /home/me/test.txt”
(For more info, see http://www.howtogeek.com/181774/why-windows-uses-
backslashes-and-everything-else-uses-forward-slashes/ )
Different commands:
The name of some commands, such as copy = cp, del = rm, move = mv, …, is
different here. You need to learn these commands to be able to use them.
(For more info, see http://www.pixelbeat.org/cmdline.html )
File / folder structure:
The Filesystem Hierarchy Standard (FHS) defines GNU/Linux and other UNIX
systems’ file system structure to be of a certain structure and design.
(For more info, see http://www.howtogeek.com/117435/htg-explains-the-linux-
directory-structure-explained/ )
Complexity of commands (Pipes (and I/O redirection)):
Try the following command and try to understand what it does:
watch "ps aux | sort -rk 3,3 | head -n 6"
So what did the command watch "ps aux | sort -rk 3,3 | head -n 6" do?
Here a description:
watch “command” = executes the command regularly
ps = show Process Statuses
aux = parameters:
a = show processes for all users
u = display the process's user/owner
x = also show processes not attached to a terminal
sort = sorts lines of text
–rk 3,3 = parameters:
-r = reverse the result of comparisons
-k POS1[,POS2] = sort based on column POS1, end it at POS 2
head = returns (e.g. displays) the first few lines of text
-n 6 = parameters
-n [number] = Returns the first [number] lines of text
The “|” character is called a Pipe and it redirects the output from one
program or command to another program or command.
Hence the full and complex command runs multiple programs that work together
to produce the final output. It operates like this:
CONTINUOUSLY-RUN( PS SORT HEAD )
Or in words: This complex command continuously runs (watch) commands that
list the top 6 (head) highest (sort) CPU intense processes (ps).
Task E) If not already done so, please go to the following link and have a look at the tutorial.
Please study and to follow all ten chapters now:
http://linuxcommand.org/lc3_learning_the_shell.php
Note that some commands and tools will not work on DMU’s SSH server for
security reasons. This is alright and you can skip these steps in the tutorial.
The purpose of following this well established tutorial is for you to get hands-on
experience and knowledge working with the Linux CLI / Shell and hence do not just
follow the tutorial but make sure to understand what all the commands do.
Please finish the tutorial in your own time by next week the latest! You will need
these skills in the coming weeks!
OPTIONAL Task F)
If you are already very comfortable with the GNU / Linux command line as well as
scripting, I would suggest you take the opportunity to look at Linux-From-Scratch.
This project is just right for enthusiasts that want to build their own GNU / Linux
system ground up.
http://www.linuxfromscratch.org/
Note: Following Linux-From-Scratch all the way through is something worth adding
to your CV is it shows you are (then) proficient with GNU/Linux, self-motivated and
that you have perseverance completing this challenging program of work.