Page tree
Skip to end of metadata
Go to start of metadata

Table of Contents

References and Prerequisites

  • Linux
    • You will need access to a Linux machine.  As part of our lab work everyone should know how to setup their own user account. 
      For your reference, we are Others may want to setup their own machines, in which case we recommend following the guide for the NPS development environment: Ubuntu 16.04, ROS Kinetic and MATLAB 2017b
    • The default user interface is GNOME. To get familiar with the interface you may want to read some of the Ubuntu Desktop Guide for Gnome.  Having a basic familiarity with the desktop will save you time in the long run.
  • Git

Giving Yourself a User Account and Setup Access to the NPS Network


Each weekly assignment will be submitted via a new git repository. NPS maintains a GitLab Server that we will use to store your repositories.  All NPS students should have access to the server using their credentials.

  1. Visit the GitLab Server 
  2. Login using your NPS credentials to verify that you have access. 

Later in the assignment you will create a repository to for this assignment.

Git Configure

On your laptop, you should set your user name and email address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating:

git config --global "John Doe"
git config --global

substituting your information for John Doe.

Learning the Shell

Work through the ten short lessons on Learning the Shell
Note:  This website is the home of the free book, The Linux Command Line by William Shotts.  We'll use this book for future exercises.

Exercise 1: Contributing to the Wiki

The Robotics Computation wiki is a collaborative space for collecting user-generated documentation that is closely aligned with this course.  You are expected to contribute to the wiki as we move through the course as a means to improve your own learning and help those that follow in your footsteps.

As practice, go to the wiki page Robotics Computation Lab and find your laptop in the Thinkpad Fleet table. 

  1. Edit the page by clicking on the "Edit" icon in the upper right.

  2. Check the NPS ID number of the computer (property tag on the bottom of the machine).  Make sure it is the same number as in the table - if it is different, edit the table
  3. Add your name as the "Current User" column for your laptop.
  4. Save the page.

Exercise 2:  Creating Directories and Files

  • Open a terminal window by either using the GNOME Applications menu or using the Ctrl-Alt-t shortcut
  • Start in your home directory - you can get to your home directory with the command

    cd ~

    where the tilde (~) is a shortcut for your home directory (e.g. /home/user)

  • Create a new directory called "sandbox" and open a text file called "commands.txt" within that directory (you can do this with the command gedit commands.txt).
  • Now, using only to command line (the gnome-terminal) create a file structure that looks like this

Note that the directories are in blue and the files are in white.  Record the command you use to do this in the commands.txt file and save it.

Exercise 3: Copying, Moving and Editing

Using only the command line, make a recursive copy of your "sandbox" directory and call it "playpen".  Now you should have the following directory structure...

Use the move command (mv) to rename the files so that your directory structure looks like this...

Record the commands that you used to do this exercise in the file play.txt.

Exercise 4: Using Tree and Redirection

The images above was generated with the command tree.  Examine the manual for the command using the command man tree.  (Note: if you get a message that tree is not installed, you can install it with the command sudo apt install tree  more on that later!)  Look for the command line option to only report the directories - ignoring the files.  The output should look like this...

Now use redirection to send the output to a new file called tree.out
Your final file structure should look something like this...

To complete the exercise you will need to add the directories and files to your Git repository, but we'll cover that shortly.

Exercise 5: New Git Repository

You will need to commit (upload) your assignment to the GitLab server.

  1. Create Repository on the Server:
    1. Go to the web interface at and login using your new account.
    2. Click on the "New Project" button in the upper right.
    3. The "Project name" of the new repository should be "mrc_hw1".  Note: It is important that you make the name of the repository exactly mrc_hw1. The name of the repository is case sensitive (remember that Linux is always case sensitive) and there is an underscore "_" between the "c" and "h" (it is best practice to always avoid spaces in directory and file names.)
    4. Choose the "Visibility Level" of the project to be "Internal".  Otherwise, the instructor won't have access to your assignment!
    5. Click on "Create project"
    6. Now you should see a page that looks something like the following:

  2. Optionally, you can cancel the automatic CI/CD pipeline to avoid getting an email notice of the pipeline failure - see Gitlab Notes for details.
  3. Create local working copy of the repository on your laptop:
    1. Follow the GitLab instructions under the heading "Create a new repository" to make a local copy of the repository connected to the repository on the server.
      Below is an example, but the URL of your remote git repository will be different (comments are included after the '#' sign)

      git clone
      cd mrc_hw1
      git add
      git commit -m "add README"
      git push -u origin master

      Then you will need to supply your username and password

    2. You can check that you were successful by refreshing the GitLAb website.  When you have successfully pushed the local changes to the remote server you should now see that you have one file, in the repository.  Like this...
  4. Add Files to the Repository
    1. Copy all of the files and directories you created into the mrc_hw1 directory so that it looks like this...
    2. Now, when in the mrc_hw1 directory, check the status of the local working copy...

      cd ~/mrc_hw1
      git status

      which should generate output like this...
      Which tells us that we need to add the new files to our local copy. 

    3. Use the git add command to add the files to your local git repository.  Now, when you issue git status command you should see output like this...

    4. Commit the local changes in your local working copy
    5. Push the local changes to the GitLab server (AKA the origin)
    6. Finally, use the web interface to double check that all of your files are now in your remote GitLab repository.



You can view the automated testing here:

  • No labels