Running a Linux Distro

In order to run a Linux distribution “inside” your Windows installation, you can use a Virtual Machine (VM). A VM is a “virtual computer running inside your computer”.

There are several VM players available. A few options:

There is also a Free & Open Source alternative, QEMU, but it is rather unix-centric and definitely the least user-friendly of the pack.

Now download a Linux distribution. I suggest downloading a user-friendly distribution, such as:

Download the installation image (also called ISO), it represents a CD-ROM or a DVD-ROM.

Now run the VM player and tell it to create a new virtual machine (details depend on the player you use). Tell it to install the Operating System from the installation image you already downloaded. There are several tutorials on how to do this, like this one.

The Linux installation menu will appear on screen. Just follow the instructions.

Hopefully everything will work out, and in a few minutes Linux will be installed in your Virtual Machine.

If you have trouble, try to ask a more experienced computer user (your colleagues, Toma, or me), or search e.g. “how to install Ubuntu on VirtualBox” on Google. There are a lot of useful tutorial online



Unix shell: a few tips

Warning

The material in this section does not play any role in the exam! It is only given for students to get a bit familiar with the Unix shell.

Opening a shell. When you open a new terminal, a new shell prompt is shown:

stefano@computer:~/$

The exact text changes between Unix distributions/versions.

In my case, the login text tells me what is the name of my user on the machine I am using (stefano), what is the name of the computer I am using (computer), and in what directory I am standing in (in this case my home directory ~).

The tilde character ~ is just a shorthand for the full path of my home directory:

/home/stefano/

Running commands. In order to run a command, say python, it is sufficient to type:

python

and press Enter, and that’s it. In order to quit the terminal, use the exit command, or press Control-d on an empty line.

Moving around. From my home, I can move to other directories using the cd command. For instance, if I am in my home directory /home/stefano/ and I type:

cd Devel/sciprog/lectures

I will move to the directory:

/home/stefano/Devel/sciprog/lectures

The special path .. can be used to go back up one level, so if I am in:

/home/stefano/Devel/sciprog/lectures

and execute cd .., I end up in:

/home/stefano/Devel/sciprog

At any point in time, I can use the pwd command to print the path of the directory I am currently in. For instance, from a newly opened terminal I could do:

$ pwd
/home/stefano
$ cd Devel/sciprog/lectures
$ pwd
/home/stefano/Devel/sciprog/lectures
$ cd ..
/home/stefano/Devel/sciprog

If I use cd alone (not followed by a path), I will move to the home directory, irregardless of where I currently am:

$ pwd
/home/stefano/Devel/sciprog/lectures
$ cd
/home/stefano

More information. Of course there are many more things you can do with/from the terminal (most of them, actually), but I won’t write about them. Feel free to consult an online tutorial, like this for further inputs.

Some useful commands:

Command Meaning
pwd Print the directory I am currently in
cd <path> Move to a different directory
ls (<path>) List contents of the given directory
mv <path> <path> Move a file/directory somewhere else
cp <path> <path> Copie a file/directory
rm <path> Delete a file/directory
mkdir <path> Create a new directory somewhere
cat <path> Print the contents of a file

And some useful key presses:

Keypress Meaning
Control-c Kill any running program (may not always work)
Control-d Means “end-of-data”, useful for exiting the terminal.
Control-l Cleans the terminal window.
Tab Auto-completes the current command/path.
, Recalls previously used commands.
history Prints previously used commands on screen.