Cabrillo College


Objectives

The goal of this lab is to become proficient with system commands for viewing the directories and different file types that make up a Unix filesystem.

Forum

If you get stuck, have a question or want to share something you learned with this lab then use the CIS 90 Forum at http://simms-teach.com/forum/viewforum.php?f=9

Procedure

Log on to the Opus server so that you have a command line shell at your service. Be sure you are in your home directory to start this lab. The questions asked in the first list of 14 steps are to check your understanding of that particular step. You do not need to record these answers.

  1. Display a listing of the files in your home directory. Are they in any special order?
  2. Use ls -a to display the contents of directory Lab2.0
    Which filenames do not follow the Unix file naming conventions?
  3. Use ls -F to determine what kind of files you have in your home directory.
    Do all directories begin with an uppercase letter?
  4. Use the file command to analyze the following files: Poems, proposal2, timecal, and empty.
  5. Display the contents of the mission file on your screen.
  6. Display the contents of the letter file on your screen.
    Is it more appropriate to use cat or more?
  7. List the filenames stored under the root (/) directory. Are these files or subdirectories or both?
  8. Determine the absolute pathname of your home directory. Use this pathname as an argument to the ls command. What are two other ways of getting the same listing?
  9. List the contents of your Poems directory using a relative pathname.
    Do the same thing using an absolute pathname, i.e. beginning with a slash (/)
  10. Display the contents of the jerusalem file stored under the Blake directory, which is under the Poems directory.
  11. Use a single more or less command to browse each of the files stored under the Yeats subdirectory. Why did you choose the command you used? How can you tell where one file ends and the next begins?
  12. Use the head and tail commands to look at the top and bottom ten lines of bigfile.
  13. Use the ls command to see what is stored in the /bin directory.
    Do you recognize any of the filenames? What kind of files are these?
  14. Display the contents of the file what_am_i. Which command did you use?
  15. Use ls -lia to do a long listing of the files in the Miscellaneous directory.
  16. Use ls -lid to do a long listing of the Miscellaneous directory itself.
  17. Use wc on some of the sonnets in the Shakespeare directory. Use man wc to understand the results or try different options. Is the operation of the man page silimlar to the more or less command?

To turn in for grading, answer the following questions. Record your answers in a text file, one answer per line. When you are done, copy your answers and paste them into a mail message to:

risimms@cabrillo.edu

with a subject of CIS 90 lab04. I will confirm that I have received it.


  1. Write down the absolute path of your home directory.
  2. Relative to your home directory, what is the pathname of the tiger file in the Blake subdirectory?
  3. What command allows you to see hidden files in your current directory?
  4. What command shows the pathname of your current working directory?
  5. Are any of your hidden files directories? If so, which ones?
  6. What does the cd command do when it is invoked with no arguments?
  7. Assuming you are in your home directory, what command will change your current working directory to the directory that holds Shakespeare's sonnets?
  8. What is the inode number of the /home/cis90 directory?
  9. Who is the owner of your home directory?
  10. What's the name of the largest text file in your home directory?

  11. What's the name and size of the smallest file in your home directory?
  12. How many subdirectories does the Poems directory have?
  13. What is the first line of the file old in the Poems/Yeats directory?
  14. What is the last line of sonnet3 in the Shakespeare directory?
  15. Which files in you home directory should you not view with the cat or more commands?
  16. What key should you type when you want to exit from the more command?
  17. What ls command-line allows you to see the permissions of your home directory while you are in your home directory?
  18. What Unix command will allow you to look at the contents of a data (binary) file?
  19. From your home directory what is the relative path to sonnet1?
  20. What Unix command will allow you to look at the contents of a data file?

  21. What command will give you a prompt showing your current working directory path and a $?
  22. How many lines are in Shakespeare's sonnet1?
  23. What english word do you see between hex offset 00000f0 and 0000100 of the file what_am_i?
  24. What file in the Miscellaneous directory is a symbolic link to another file?
  25. What is the inode number of the file being linked to?

  26. Extra Credit (2 pts): With what command can you list only the hidden files of your home directory?