Unix Exercises

These exercises are intended to introduce you to the bare minimum of commands required to manage your data for use with the GCG sequence analysis programs - creations of directories for specific projects, copying of files from somewhere else on the computer, minor editing of files, running a couple of GCG programs to analyze the sequence files, and so on. 

The mkdir command.

1. After you have logged in, create in your home directory, a practice directory called Exercises. Remember that UNIX is case sensitive!

The cd command

2. Change into that directory. Create several other directories called Question1, Question2, ....  Bearing in mind that leaving a space in a directory name is possible, but undesirable, and also that UNIX is case-sensitive.

The cp command

3. Into the Question1 directory, copy a file called fortuesday.seq from the /tmp/chad directory. This is a sequence from e coli.  

Editing a file (pico, emacs, or vi) - there is a web section on file editing....

4. Edit the header information (before the ".." line in the file) to indicated that the sequence is derived from e coli and to indicate what directory you found it in.

a GCG command.

5. Run the GCG reformat command, naming the output file as ecoli-gene.seq

The cp command again....

6. Make a second copy of the file in the directory called Question2.

The mv command.

7. Change the name of the file in the Question2 directory to 2nd-ecoli.seq

another GCG command.

8. run the map command with 2nd-ecoli.seq as input and requesting only those enzymes which are 2-cutters.

Looking at files (more, less, cat, tail)  - remember there are man pages for each command.

9. Examine the output of the command (using more, less, cat, or tail) and count the number of enzymes which cut the sequence twice.

The chmod command - making files available to co-workers for their inspection and copying.

10. Using the chmod command, change the permissions on the file in the Question1 directory (and the directory itself) so that anyone logged into Ranger can read the file (but not alter it).  The permissions for the directory will read: rwxr-xr-x and the file permissions will read rw-r--r--  when you are finished with this.  You may also need to change the permissions on files and directories above the Question1 directory to accomplish this.  You will almost certainly need to read the man page for chmod in order to do this.

chmod(1)                                                             chmod(1)
 
NAME
 
  chmod - Changes permission codes
 
SYNOPSIS
 
  Absolute Mode
 
  chmod [-fR] absolute_mode file...
  chmod [-fR] absolute_mode file...
  Symbolic Modebsolute_mode file...
 
  chmod [-fR] [who]+permission ... file...
  chmod [-fR] [who]+permission ... file...
  chmod [-fR] [who]-permission ... file...
  chmod [-fR] [who]-permission ... file...
  chmod [-fR] [who] = [permission]... file...
  chmod [-fR] [who] = [permission]... file...
  The chmod command modifies the read, write, and execute permissions of
  specified files and the search permissions of specified directories.
 
STANDARDS
 
  Interfaces documented on this reference page conform to industry standards
  as follows:
 
  chmod:  XPG4, XPG4-UNIX
 
  Refer to the standards(5) reference page for more information about indus-
  try standards and associated tags.
 
OPTIONS
 
  -f  [Compaq]  Does not report an error if chmod fails to change the mode on
      a file.
 
  -R  Causes chmod to recursively descend its directory arguments, setting
      the mode for each file as described in the sections Symbolic Mode and
      Absolute Mode.  When symbolic links are encountered, their mode is not
      changed and they are not traversed.
 
OPERANDS
 
file
      Pathname of the file that is to have the permission bits modified.
 
  absolute_mode
      Octal permission_code for setting the file permissions.  This code is
      formed as described under Absolute Mode in the DESCRIPTION section.
 
  who Specifies whether permissions are being defined for a user, group, or
      all others.  This operand is more fully described under Symbolic Mode
      in the DESCRIPTION Section.s more fully described under Symbolic Mode
 
  + | - | =
      Specifies the operation to be performed on the permissions being
      defined.  This operand is more fully described under Symbolic Mode in
      the DESCRIPTION Section.
 
  Permission
      Specifies the permissions being defined.  This operand is more fully
      described under Symbolic Mode in the DESCRIPTION Section.
....
EXAMPLES
 
   1.  To add a type of permission to several files, enter:
            chmod g+w chap1 chap2
            chmod g+w chap1 chap2
       This adds write permission for group members to the files chap1 and
       chap2.
 
   2.  To make several permission changes at once, enter:
            chmod go-w+x mydir
            chmod go-w+x mydir
       This denies group members and others the permission to create or
       delete files in mydir (go-w).  It allows them to search mydir or use
       it in a pathname (go+x). This is equivalent to the following command
       sequence:
            chmod g-w mydir
            chmod o-w mydir
            chmod g+x mydir
            chmod o+x mydir
            chmod o+x mydir
   3.  To permit only the owner to use a shell procedure as a command, enter:
            chmod u=rwx,go= cmd
            chmod u=rwx,go= cmd
       This gives read,,write, and execute permission to the user who owns
       the file (u=rwx).  It also denies the group and others the permission
       to access cmd in any way (go=).