James Madison University, Fall 2018 Semester
Lab02: Unix tutorial for beginners
Background
The PCs in ISAT/CS 143 and ISAT/CS 250 run Linux Mint, and the iMacs in ISAT/CS 248 used to run macOS. Both operating systems are based on Unix and come with a powerful suite of general purpose computing tools. Many of these tools are only available via the command-line interface (also known as the "Terminal"). You will learn some of these commands in this course and others throughout your career. Today we will focus on the basic survival skills for navigating the command line and a Unix-based file system.
Part 0: Getting Started
There are multiple options for completing this lab: (1) use a Linux machine in the CS department, (2) connect to the student server using SSH or PuTTY, or (3) get things working on your own computer. We recommend (1) if you are starting this in class, but then also recommend completing the last option, since it will enable you to be more productive throughout the course.
-
If you have a Mac computer, everything you need is already built-in. Simply find the "Terminal" app (press Command-Space to search for it). You may want to add this app to your Dock permanently, since you'll be using it a lot.
-
If you have a Windows computer, you may want to install Cygwin. This collection of tools provides a UNIX-like environment on Windows and creates a Terminal shortcut on your desktop.
-
If you're not sure how to run the installer, search YouTube for instructions. But don't spend too long installing Cygwin if you run into problems. Use option #1 or #2 above for today's lab, and then bring your laptop to office hours later this week.
-
Cygwin creates a separate home directory from your Windows home. When running Cygwin for the first time, paste the following three commands (exactly as shown!) into your terminal. Please read the instructions below before doing this part.
ln -s /cygdrive/c/Users/USERNAME/Desktop ln -s /cygdrive/c/Users/USERNAME/Documents ln -s /cygdrive/c/Users/USERNAME/Downloads
The "ln" command means "create a link" or shortcut. After running these commands, you should see your original Desktop, Documents, and Downloads folders in your Cygwin home directory.
Be sure to replace the word USERNAME in the commands above with your Windows username. If you don't know your Windows username, you can type "
ls /cygdrive/c/Users
" and see how it is spelled. Don't use ALL CAPS -- use the same case thatls
outputs.
Part 1: Video Tutorial
Once you have a Terminal running, watch the video below and follow along on your own computer by typing the same commands. Pay attention to how the video demonstrates tab-completion. The up/down arrows and the tab key are your best friends when working on the command line!
Part 2: Online Tutorial
Work through the first four parts of UNIX Tutorial for Beginners. The first part is more or less a review of the video. The fifth part is optional.
Download the Lab02.txt worksheet (right-click, Save link as..., navigate to CS149/Lab02) and answer the questions. Open the file using a text editor (e.g., gedit on Linux, TextWrangler on macOS, Notepad++ on Windows).
Make sure you save this file as plain text; if you use Word or LibreOffice, you'll need to "Save as" and change the type to "Plain Text". And please do NOT change the name of the file; Canvas automatically appends your first and last name to the file when I download the submissions for grading.
Upload your completed worksheet to Canvas by the end of the day. If you have questions, feel free to start a discussion on Piazza.