Tutorial #3 - File Manipulation Unix Commands:
cp, mv, rm, cat, more, lp
1. Log on to Unix if necessary.
2. Display your directory, and then make a copy of new_file called
direct.two and a copy of year.file called this.year.
3. Change the name of year.file to what.year. Check your directory
listing again.
4. Add the calendar of 1999 to the this.year file.
5. Try to delete a file named next.year (if you already have a file
named next.year, use a name that isn't in your directory). Delete
the file direct.two; use the -i option so Unix will ask you to confirm
it after the command is issued.
6. At this point your directory contains these files: new_file, this.month,
this.year, and what.year. Use the cat command to create one called
my.address that contains your address in at least three lines.
7. Display the contents of a few of your files on the screen.
8. Create a new file named many.years that holds the contents of this.year
and what.year. Then in a separate command, add the file my.address to
the end of it and display the result.
9. Display the contents of many.years; try to pause the display with .
Then try displaying it using the more command. When you're finished,
delete this file.
10. Request a printout of one or two of these files, then log off.
If it doesn't work:
A. Practice a bit more and re-read the appropriate sections in your book
and/or notes. If necessary, use the man to get on-line
manual help for a unix command. Basic file maintenance operations are
crucial to maintaining the files in your directory.
B. Question 8 can be solved with cat this.year what.year > many.years.
The next command is worked as follows: cat my.address >> many.years.
C. If your system does not permit direct printouts, use the PC windows
workaround: (Download the displayed file to a windows system, open
it up with Microsoft Word (or other text editor) and print it from
that word processor).
Questions? Robert Katz:rkatz@ned.highline.ctc.edu
Last Update June 26, 2001