1.2. Lab assignment 1#

This section describes the requirements to complete Lab 1 of TU Delft’s RO47003 “Robot Software Practicals” 2025-2026.

Important

  • Before you start, go to the course’s Brightspace page and enroll in a group of one. You can do this on Brightspace by going to Collaboration ‣ Groups ‣ Lab enrollment. It will just be a group of one person, we will assign you later a lab partner randomly. Also, go to the Gitlab page (https://gitlab.ro47003.me.tudelft.nl/), and log in with your TU Delft credentials. The deadline for enrolling in a group on Brightspace and logging-in on Gitlab once is Wednesday, September 10, 2025, 23:59!

  • You will work on this hand-in assignment with your assigned lab partner. Carefully read the minimum submission requirements listed in Section 1.2.2 to avoid penalties. The hand-in task for this lab assignment will be described in Section 1.2.4, for which you have to commit code to your group’s new Git repository.

  • The deadline for this assignment is Wednesday, September 17, 2025, 23:59. To submit, do not send anything to the Teach Assistants (TAs) or lecturers, but ensure that you and your partner’s work is in the main branch in your group’s private lab 2 repository.

  • You may only hand in your own work, and you are responsible for not sharing your code with students outside your group. Only use the Gitlab repository we will provide to collaborate with your partner. If we believe you have used material from other groups, or you have submitted material that is not yours, it will be reported to the exam committee. This may ultimately result in a failing grade or an expulsion.

  • Finally, if you find errors, ambiguously phrased exercises or have questions about this assignment, please use the Brightspace lab support forum.

1.2.1. Study material#

For this assignment you should first work through the Linux manual (Section 2).

The manual contains various exercises for you to practice the explained concepts. You do not need to hand in the solution to any of these exercises. However, it is in your own interest to complete all of the exercises you find throughout the text: you will need all of the insight you acquire in this module to successfully complete the others.

Once you have worked through the manual, you should be able to complete the hand-in assignments detailed below.

1.2.2. Minimum submission requirements#

The assignments will be handed in using a private git repository for your lab group hosted at the TU Delft. So, do not use an account on gitlab.com, github.com nor bitbucket.com. Code uploaded to those services will not be graded. Private emails to instructors or TAs with solutions will also be ignored. You must use the provided Git repository throughout Section 2.6, and must use it for the final exercise of this lab assignment.

We will create a random group of you with another student and give you the URL of your group’s Gitlab repository. For this to happen you must have enrolled in a group on Brightspace (only of yourself, i.e., group of one person, and we will later assign you a partner randomly ourselves) and that you have logged in at least once on the TU Delft Gitlab page (https://gitlab.ro47003.me.tudelft.nl/). The deadline for you to enroll in a group (of one) on Brightspace and logging-in on Gitlab is Wednesday, September 10, 2025, 23:59. Please note that if you have not created a group on Brightspace and have not logged-in once on Gitlab, we cannot create a repository for you.

The deadline for the submission of this assignment is Wednesday, September 17, 2025, 23:59. Before that deadline, it is obligatory that

  • your group’s work must have been placed in the group’s private repository on the TU Delft Gitlab server, provided by us,

  • all files created for the final exercises must be included in the main branch on Gitlab, which is the only branch that will be checked,

  • both lab partners must have contributed at least one git commit to the main branch (note that Git and Gitlab will be discussed in Lecture 2).

If code is submitted that was written with ill intent, e.g. to manipulate files in the user’s home directory that were not specified by the task, or which collects user passwords, you will immediately fail the course.

Danger

These minimum submission requirements should be easy to fulfill for any student actively participating in the lab assignments. Note that these requirements do not say anything about the completeness or quality of your code, but they are a hard requirement (ie: a lower bar) that demonstrate a sufficient minimum effort before the deadline.

If you fail to fulfill these minimum submission requirements, the penalty stipulated on the course information will be applied.

1.2.3. Feedback#

You will receive feedback on the following points of your solution:

  • The quality of your code: is the code well organized, and not over complicated?

  • The quality of your solution: does the code do what it is supposed to do?

  • The quality of your documentation: does the readme explain how to use the code, and is the code itself well commented?

1.2.4. Hand-in assignment Lab 1#

Make sure that all your code is correctly pushed to the ME gitlab repository at the URL that you have received from us! For grading we will check the code that you pushed to gitlab before the deadline.

In this repository, we expect to see the solution scripts to the exercises below that require them. Additionally, you will make a single README.md that explains what exactly every script does, and how they can be used. Note that none of the exercises require the use of temporary files in any of the steps.

If you have used branches, make sure that all work is merged into the main branch. Look at the repository in your browser to see if all files are there, and that the README.md is easily readable.

1.2.4.1. Task 1 - Keep your repository up-to-date#

When you hand in your solution to the tasks, ensure that you include all necessary files, and only the necessary files.

Task deliverables

  • The README contains both your student names and numbers;

  • The README states any resources from which you copy-pasted code, such as ChatGPT;

  • The README text should be written for students following this RSP course, so you should not need to explain Singularity, the Virtual Machine, etc. You should assume only packages in the provided Singularity image are available, and thus should not require package installation instructions.

  • Your repository should include files you created to complete this assignment including configuration files and source code. If other files that you did not create should be included, this will be stated explicitly in the task description.

  • By following the instructions in your README and with your provided files, a capable student should be able to reproduce your result and be able to check that you completed all tasks.

Important

  • The repository should not contain any debug code, unnecessary files or directories, or binary files such as rosbags.

  • The repository should not contain a custom ROS package! It should also not be required. This is not covered yet in this lab assignment, and also not suitable for peer-review at this stage. Even if you already know how to create new ROS packages, you must solve the tasks as described in the task description, and not make it more complex!

1.2.4.2. Task 2 - Implement your own copy command#

Create a script mycp <input file> <output file> that copies a <input file> to <output file> without using cp. Useful commands could be ls, cut and tr. Creative solutions will certainly be appreciated! Make sure your script works correctly: compare it to the behaviour of cp.

Note that your script only needs to support copying of a single source to a single destination ((recursive) copying of directories is not needed), but it should be able to copy all sorts of files, not just text files.

Task deliverables

  • The mycp script;

  • The script committed to the repository with at least one commit message (you can use multiple commits to improve or debug the script, but don’t use one commit for multiple hand-in tasks);

  • An explanation on how to use the script, together with an example, in the README

1.2.4.3. Task 3 - Search and copy#

Write a script mygrepcp <input directory> <query> <output directory> that takes as input a directory <input directory> containing text files, a search string <query>, and an empty directory <output directory>. The script should copy all files in the input directory which contain the search query to the output directory. You can use grep for this.

Task deliverables

  • The mygrepcp script;

  • The script committed to the repository with at least one commit message (you can use multiple commits to improve or debug the script, but don’t use one commit for multiple hand-in tasks);

  • An explanation on how to use the script, together with an example, in the README

1.2.4.4. Task 4 - Display free space in shell prompt#

Make your shell display the amount of free space (in Gibibytes) on the disk of the root directory as part of the prompt. Create a script called mydf, and make use of the output of the df utility. Again: creativity is key.

Task deliverables

  • The mydf script;

  • The script committed to the repository with at least one commit message (you can use multiple commits to improve or debug the script, but don’t use one commit for multiple hand-in tasks);

  • An explanation on how to use the script, together with an example, in the README

Tip

You can use the PROMPT_COMMAND variable to change your prompt. The cat command has information on viewing and manipulating file contents.

1.2.4.5. Task 5 - Stop all processes#

Write a script killme <username> that terminates all processes of a specific user.

Task deliverables

  • The killme script;

  • The script committed to the repository with at least one commit message (you can use multiple commits to improve or debug the script, but don’t use one commit for multiple hand-in tasks);

  • An explanation on how to use the script, together with an example, in the README

Tip

  • You can use ps aux to get a list of all processes

  • Filter that list to get only processes you’re interested in (with which Section 2.5.2.2 could help)

  • cut -fX can help you to extract specific words from lines

  • Refer to Section 2.8.4 for information on process management

1.2.4.6. Task 6 - Display news headlines#

Write a script readnews that displays the current headlines on Dutch Teletekst (a simple news service). Print only the headlines on the first page, without any markup, on the console.

Task deliverables

  • The readnews script;

  • The script committed to the repository with at least one commit message (you can use multiple commits to improve or debug the script, but don’t use one commit for multiple hand-in tasks);

  • An explanation on how to use the script, together with an example, in the README

Tip

  • You can use wget to download http://teletek.st

  • You will probably have to do some filtering of the text to get rid of HTML markup elements

  • Special characters (diacritics, etc.) may be ignored, but this can result in `strange’ characters being printed on the console

1.2.4.7. Task 7 - WebVM#

In this question you’ll use a online terminal emulator running Bash called WebVM (click to open). This setup mimics you remotely logging into a robot or server via ssh: you can only interact with the system through this terminal.

Note

Note that in reality you are not connected to a Linux server, this emulator is running code in your browser on your computer. Nevertheless, this shell emulator connects to a remote Linux Kernel tool, and also leads its initial file system state from a remote server. Just to be sure, don’t enter privacy sensitive information in this emulator (just as with any other website).

Perform the following subtasks:

  1. In all files in the user’s home directory, and its subdirectories, how many lines in total contain the string if?

  2. Locate the system log file dpkg.log, which is not stored in the user directory but one of the system directories. In this file, what is the first log message for May 5, 2023, 10:51:43 ?

  3. Somewhere in the user’s home directory (or one if its subdirectories) is a Python script called factorial.py. Execute this script on this server using the python command. The python command takes as argument the path to the script that you want to execute. If you do, you will see it by default computes up to \(50!\). Copy this python script to the home directory, and edit it there such that it now computes up to \(55!\). What is the last line the program produces?

  4. Create a new file hello.txt in the user home directory, it doesn’t really matter what content you save in it. What are the read, write, execute permissions of this new file?

  5. In the user home directory, initialize a new git repository called myrepo. In this repository, make a file (content and file name doesn’t matter), and add it to an initial commit. Once you have made an initial commit, check the repository’s git log. What is the name of the branch on which the initial commit was made?

  6. The /etc/passwd file contains user names and login information. On each line in this file, the user name is the first part of the line till the : symbol. From the user names in this file, how many contain a - (dash)? Tip: first extract a list of only the names from this file, then filter the ones containing the dash, and finally count them.

  7. The directory /usr/share/doc/ stores the documentation for various installed programs, each in a separate subdirectory per program. Make in your home directory a new directory, and copy into this new directory first all documentation files for the wget program, and then also all files for the zip program, and the ssh program. How many files or subdirectories terminating with the .gz extension does this new directory now contain?

Task deliverables

  • Describe in you README for each of these subtasks:

    • Provide the answer you found.

    • Provide the command or commands you used to find the answer. Another person should be able to enter the commands “as is” in the terminal to obtain the same answer. Try to make the commands generate the requested answer as output in the terminal. Try to obtain this answer with the least number of commands (some tasks may be solveable with a single line in the terminal).

    • Give a short explanation for each command that you used to explain why it is a necessary step to obtain the answer.

  • Since you should perform these subtasks on the WebVM, not on your own system, you should not add scripts for all these subtasks. You only need to describe the used commands and results in the README.

Tip

  • This emulator emulates a very minimal Linux system, it does not have many of the system utilities and larger programs that you will find in your regular Ubuntu installation.

  • WebVM can be a little slow at times, especially when accessing the virtual disk. Please allow for sufficient time to pass between attempts to rerun or abort a command.

  • If you close WebVM in your browser, you may lose all unsaved changes you made to its virtual file system.

  • If you accidentally delete a file or directory needed for an exercise, you can reset the disk using the Reset disk option from the WebVM “Disk” menu on the left. Note: this will reset everything! It is not a multi-step Undo feature.