Version 4 (modified by rpwagner, 6 years ago)

--

Schedule LabAssignments LabInstructions

Lab One

Lab Wiki Page

Create the wiki page for your assignment. Use your first name and the lab number for the title, like DebbieLabOne. Only use your first name, and you'll need to use the word One instead of the number. Go ahead and link the page to the LabAssignments page.

Exercises

Exercise 1.1

Suppose ls shows you this:

Makefile    biography.txt   data    enrolment.txt   programs    thesis

What argument(s) will make it print the names in reverse, like this:

thesis  programs    enrolment.txt   data    biography.txt   Makefile

Exercise 1.2

What does the command cd ~ do? What about cd ~hpotter?

Exercise 1.3

What command will show you the first 10 lines of a file? The first 25? The last 12?

Exercise 1.4

What do the commands pushd, popd, and dirs do? Where do their names come from?

Exercise 1.5

How would you send the file earth.txt to the default printer? How would you check it made it (other than wandering over to the printer and standing there)?

Exercise 1.6

The instructor wants you to use a hitherto unknown command for manipulating files. How would you get help on this command?

Exercise 1.7

diff finds and displays the differences between two text files. For example, suppose you had a file named earth.txt, that contained the following lines:

Name: Earth
Period: 365.26 days
Inclination: 0.00
Eccentricity: 0.02

and you modified it so it now looked like this:

Name: Earth
Period: 365.26 days
Inclination: 0.00 degrees
Eccentricity: 0.02
Satellites: 1

You can then compare the two files like this:

$ diff earth.txt earth2.txt
3c3
< Inclination: 0.00
---
> Inclination: 0.00 degrees
4a5
> Satellites: 1

(The rather cryptic header "3c3" means that line 3 of the first file must be changed to get line 3 of the second; "4a5" means that a line is being added after line 4 of the original file.)

What flag(s) should you give diff to tell it to ignore changes that just insert or delete blank lines? What if you want to ignore changes in case (i.e., treat lowercase and uppercase letters as the same)?