Cabrillo College


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.


If you get stuck, have a question or want to share something you learned with this lab then use the CIS 90 Forum at


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 17 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 similar 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:

with a subject of CIS 90 Lab 4

Note, we have not learned about UNIX text editors yet so you may use your favorite text tool on Windows or Mac to record your answers. If you use your regular non-Opus email, send you answers as part of the message and NOT as an attachment. If you send your answers using /bin/mail on Opus (as in Lab 3) then you will earn some extra credit!

  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/cis90ol 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. What are the filename(s) of file(s) in your home directory that you 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. Which file in /boot/grub has inode number 12051?

  21. What command will set your prompt to show 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?

Bonus question (extra credit): With what command can you list only the hidden files (and nothing else) of your home directory?

Grading Rubric (30 points total)

1 point for each correct answer to questions 1 to 20.
2 points for each correct answer to questions 21 to 25.

Extra Credit

5 points extra credit for answering the bonus question above correctly
5 points extra credit for using /bin/mail on Opus to email your answers