Tutorial #2 More UNIX Commands: cal, date ls

1. Log on to Unix.

2. Display the current date, then the current year's calendar on the screen.  

   Notice that the year's calendar may scroll off the screen before you can 

   read it.

3. Display the current month's calendar on the screen.  You may have to 

   specify the year as well.

4. Try typing cal and pressing Return.  If you get a display, your Unix 

   version has some extensions.

5. Use redirection to create a file named year.file in your directory; 

   put any years calendar in it.

6. Use the ls command to check your directory to see the files listed.  
   
   Try again to see any hidden files.  Try a long listing to see the 

   date and time that you created the files.  The total shown includes 

   the hidden files as well.  Don't worry about the information in these 

   listings; just note the file names.

7. Use redirection to make a file called this.month, containing only the 

   current month's calendar.  Then use the date command to append the 

   current date to the end of the same file.

8. List the directory again.  Notice that the files are in alphabetical order.

9. Use redirection to store the long current directory listing in a file 

   named new_file.

10. Practice more with the date, cal and ls commands if you want; then log off.


If it doesn't work:

A.  If your system doesn't generate onscreen calendars, make sure you used
 cal 2001 and cal 4 2001 as the formats.

B. For redirection, use a format such as cal 2001 > year.file in question 5; 
cal 4 2001 >> this.month in question 7, and ls > new_file in question 9.

Questions? Robert Katz:rkatz@ned.highline.ctc.edu
Last Update June 26, 2001