CSc 352: Assignment-1: Basic Unix Commands
Due Monday, June 10th
-
Make sure you have a Unix account on lectura.cs.arizona.edu
If you don't have an account,
go apply for one (Gould-Simpson Building, Room 737).
-
Read the man page for the command wc. Hence figure out how you
can determine the number of lines, words, and characters in a file
(see also pages 12-13 of The UNIX C Shell Field Guide by
Anderson and Anderson).
-
Read the man page for the command sort, as well as the information
for this command in The UNIX C Shell Field Guide by
Anderson and Anderson.
-
Read the man page for the commands head and tail,
as well as the information
for this command in The UNIX C Shell Field Guide by
Anderson and Anderson. Hence figure
out how you can extract, for any specified number n (n
> 0), the nth. line from the beginning, or from the
end, of a given file.
You are to create two files, myStmt and myOutput, as directed
below, and then submit them electronically on host lectura.cs.arizona.edu
using the command
-
turnin cs352_hw1 myStmt myOutput
Please follow the directions below carefully: submissions that don't
follow directions will be penalized heavily.
-
Use a text editor under Unix to
create a file called myStmt that describes (a) what your
major is, and why you chose that major; and (b) why you are
enrolled in this course (CSc 352), and how it relates to your major.
Use wc to make sure that this file contains at least 20 lines and 100
words.
-
Create a file myOutput containing the following information, one item
per line:
- Your lectura login id;
- The number of characters in your myStmt file;
- The total number of files(including hidden files) in the directory /usr/local/bin;
-
The number of bytes in the largest file in the
directory /usr/local/bin on lectura.
-
The smallest number in the file /home/cs352/SUMMER02/Hw1Input/NUMBERS
on lectura.
-
The largest number in the file /home/cs352/SUMMER02/Hw1Input/NUMBERS
on lectura.
-
The 10th. line from the beginning of the lectura file
/home/cs352/SUMMER02/Hw1Input/BINFILES.
-
The 210th. line from the beginning of the lectura file
/home/cs352/SUMMER02/Hw1Input/BINFILES.
-
The 99th. line from the end of the lectura file
/home/cs352/SUMMER02/Hw1Input/BINFILES.
Sanity Check: Count the number of items you've been asked
to put into your myOutput file; use wc to count the number of lines
in your myOutput file. Do they match?