NEW BRUNSWICK COMPUTING SERVICES
USER SERVICES GROUP

Getting Started With The UNIX Operating System
Exercise 3

Dealing with Files

After completing the practice, you will be able to view files and create empty files. In addition, you will create proper and improper file names, and observe the results. This practice will also generate error messages to familiarize you with what some error messages look like.

  1. Issue the command:

    cd

    to go to your home directory.
  2. Issue the command:

    cd UNXclass

    to go to the UNXclass subdirectory.

  3. In the current directory, list all files in long format. What different types of files (plain files, directories, links or other) do you have?


  4. The touch command can be used to create a new, empty file. Use the following command to create a file named sky:

    touch sky

    What command will show you if you succeeded and the file sky now exists?


  5. Attempt to create three empty files with the commands:

    touch baseball bat
    touch -bigfile-
    touch chili&beans


    What error messages occur and are any files created?

    The above are examples of poor choices of file names.

  6. Issue the following command and briefly describe the results:

    cat big.file


  7. Now issue the following command and observe the results:

    more big.file

    What is the difference between the commands "cat" and "more"?


  8. When would you use "cat"? When would you use "more"?


  9. How many lines in big.file contain the character string "tcsh"? What command did you use?


  10. Copy the file "orig.1" to "copy.1". What is the command?


  11. Check your quota status. What command did you use? Are you close to either your quota or your limit?


  12. What is your disk usage in the current directory and below? What is the command?


  13. Check and note the size of the file "big.file" (hint use "ls -s"). Reduce it with gzip and check the size of "big.file.gz". Note below, roughly, how much reduction occured? Restore the file with gunzip.
After attempting the above look here for answers

End of Practice 3 - Dealing with Files