Linux and shell exercises

-See Linux and shell material here

Marco and polo

A+ presents the exercise submission form here.

Add shebang

A+ presents the exercise submission form here.

Basename extension

A+ presents the exercise submission form here.

Fibonacci series

A+ presents the exercise submission form here.

Version control

These exercises have been inspired by Julia Evans’s git exercises

To get started, clone the Scala programming language repository:

git clone

Having cloned the repository, cd to it.

We will navigate this repository to get an idea how files have changed over time. You need to be familiar with some command line utilities such as wc -l, xargs, find, and pipe.

Type in the commands you would use in a shell for the following exercises.

See what branch you are currently on (where HEAD points to).

The main line development is usually called master. This is only a naming convention and master is only a branch. As seen in this example, the “main” branch is not named master but after the latest stable version of Scala.

See what commit hash corresponds to HEAD.
Check out Martin Odersky’s (creator of Scala) first commit in 2003 with commit hash 4177daab2f54bdb20c71f623296a8bb32616fd12.
Now see how many lines of code Scala was at the time. Hint: Scala was originally written in java. For this exercise you should count the lines of all files with java extension (find, wc, and xargs are useful in this exercise).
Create a new branch named my-local-branch that points to this commit hash 4177daab2f54bdb20c71f623296a8bb32616fd12 Check the branch out and see how it differs from the 2.13.x branch (e.g. ls, git log).
Switch back to the main branch.
Take a look at the history of file src/compiler/scala/tools/nsc/CompilerCommand.scala
Take a look at the commit 205f1c532d0a1b54a2b1874db4c4a553284911b6 to see the changes made to the file src/compiler/scala/tools/nsc/CompilerCommand.scala.
Get a diff on the file src/compiler/scala/tools/nsc/CompilerCommand.scala to see how it has changed since first created: Compare the one on the 2.13.x branch with the one at commit ac849228490d5a0e2d3f048d649297d5c59b6ade.
Find out how many files have been changed since the last commit Hint: Get diff between HEAD and the previous commit.
Find out how many commits have been made to the src/ directory. Hint: See the –oneline flag for git log.
Find out the commit hash that corresponds to tag v2.10.0.
How many commits were made between tags v2.13.1 and v2.13.2? Hint: See how .. works and make use of –oneline flag and command line utility wc -l


SSH tunneling

Let’s imagine you would like to get full access to a paper that is not on an open access publication. You do not however have access to Aalto VPN. One workaround is to set up a tunnel from your computer to some computer inside Aalto network to encrypt and route all internet traffic to and from the computer residing in Aalto network, in this example Kosh.

You need to also set proper proxy settings on your OS/browser, that is go onto the proxy settings on your OS/browser, select protocol SOCKS, set proxy server address to and specify a port.

Assuming you want to set the port to 12345, which of the commands below should be used for this port forwarding example?


A+ presents the exercise submission form here.


Posting submission...