Lab 2. Linux
For the activities in this lab, first log in to your Linux as you did in Lab 1. Perform a git pull
on your repository to make sure it is up to date.
This lab has the following goals:
- Gain experience navigating the Linux environment.
- Gain experience using a terminal-based text editor---
Vim
. - Get acquainted with Assembly programing.
Part 1. Solve the Mystery
Use cd
to navigate into your lab2
directory. Once you're in there, use the
ls
command to list that directory's contents. Then use cd
to go into the
clmystery
directory. You'll notice a file named instructions
! Read it
using the cat
command.
Some shotcuts you may find useful:
Up arrow
: repeat the previous command<tab>
(or double<tab>
): auto-complete filename or path<ctrl> + c
: terminate the current running command
While following the instructions to solve this problem, please take notes to show your thought process, i.e., how you reach to the final conclusion. After you've solved the mystery, show the final answer and your note to your instructor and get checked off!
Part 2. Terminal-based Text Editor Training
The Linux command-line terminal, or shell, is an extremely powerful tool. When you launch your Linux in WSL2, you control the machine solely through this text-based input.
One common task on the command line is text editing (analogous to using Notepad on Windows or TextEdit on Mac.) For simple text-editing tasks, one can use nano
. However, it is very worthwhile to learn a more sophisticated editor such as vim
or emacs
. These editors come with a slightly steeper learning curve, but once a user is up to speed, their many useful functionalities can boost productivity. In this part of the lab, you'll get to know one of these text editors.
In this class, we will choose Vim
as the text editor
Vim
vim
will likely already work on your Linux. However, it is a thin installation of the software (in particular, it doesn't include the tutor.) So install a more complete package: sudo apt install vim
Once the installation is finished, run the following command in the terminal to install some useful configures, e.g., showing line number and etc.
wget -O ~/.vimrc https://www.rose-hulman.edu/class/csse/csse132/vimrc
Read the Tutorial: un vimtutor
to open the official tutorial.
There are 7 lessons in total in this tutorial, but you only need to go through lesson 1 to lesson 6. When you are reading
the tutorial, write down the keyboard shortcuts for following operations on your instructor verification sheet:
- Flip to the next/previous page
- Go to a certain line with a line number
- Go to the end of the current line
- Insert text at the end of current line
- Copy (or cut) a line and paste it
- Select and copy (or cut) multiple characters and paste them
- Select and copy (or cut) multiple lines and paste them
- Search a word in the text
- Undo and redo (i.e., redo an undone action)
Show your instructor
To check this item off from your instructor verification sheet, you will be tested to demo some of the operations mentioned above.
Part 3: Assembly Practice
- Go to the
writeAssembly
folder underlab2
. - Implement the functions in
problems.s
Once you finish writing a function, you can type
make run
to test your code.
- Show the output to your instructor, once you pass all tests.
Finishing the Lab
- Scan and Upload the signed instructor verification sheet to GradeScope.