Beginning Unix

From 22118
Jump to navigation Jump to search
Previous: Programme Next: Intermediate Unix

You did do the Course preparation, right!! Otherwise all of this matters not.

Required course material for the lesson

Powerpoint: Introduction to Unix
The videos are not entirely in sync with the powerpoint, as it has been updated.
Video: Unix intro and navigation
Video: Coping, Moving, Renaming files. Changing permissions
Video: Using shortcuts in Unix - making it easier
Video: File inspection and editor in unix. 1½ min silence at the end
Video: Manipulating files: wc, paste, cut & sort
Video: Manipulating files: grep and pipelines
Video: Touching upon various relevant subjects
Youtube: NetworkChuck's Unix course. Maybe you find him more entertaining than me.
Resource: The resource on Unix for many courses at Health Tech
Resource: Biological knowledge needed in the course
Resource: UNIX Tutorial for Beginners from University of Surrey
Resource: UNIX/LINUX Tutorial from TutorialsPoint

Subjects covered

  • Basic file handling in UNIX.
  • Understanding and navigating the file system.
  • Many different Unix commands

Exercises to be handed in

Use a text editor to to create a file mycommands.txt where you write all commands and observations you do in the following exercises. Use copy/paste to copy the commands.
Note: Make sure that we can easily see which exercise you attempt to solve.
Note: You should work from your home directory, or a work directory that you specify explicitly in the top of your hand-in.
Note: Data files can be found in the collection of files.

It is assumed that you have downloaded the 3 files; ex1.dat, ex1.acc and orphans.sp before you start the exercises

  1. First list the files in the directory.
  2. Copy ex1.acc to myfile.acc.
  3. Look at the content of both files to ensure they are identical.
  4. Copy ex1.dat to myfile.acc.
  5. Check that the content of myfile.acc changed.
  6. Delete myfile.acc.
  7. Make a directory test and move the three files to it.
  8. Make a directory data and move the three files to that instead.
  9. Remove test' directory.
  10. Change directory to data and confirm that you succeeded. Go back to the home/work directory afterwards.
  11. Make three new directories newtest - one inside the other, like a Russian doll.
  12. Move the data directory to the innermost newtest directory.
  13. Confirm that the three files are moved along with the data directory.
  14. Copy the three files to your home (your top directory).
  15. Remove all newtest directories and data in the with a single command.
  16. Count the lines in ex1.acc and ex1.dat.
  17. Concatenate ex1.acc and ex1.dat in the file ex1.tot, i.e. copy the content of two files into one new file. Verify that all gene IDs comes first followed by numerical data.
  18. Merge/Paste ex1.acc and ex1.dat together in ex1.tot, thus destroying the old file. Verify that corresponding gene IDs and numerical data are put on the same line as the data.
  19. Extract (cut) SwissProt ID and 3nd numerical data (column 1 and 5) from ex1.tot. Put results into a file ex1.res.
  20. Find the 3 SwissProt ID's in ex1.res which have the largest number(s) in column 2, i.e. the top 3 entries. Display only the ID's.
  21. Find the lines (using grep) in orphans.sp which contain a GenBank accession number. There are 85, verify this. Note: An accession number is one or two capital letters and looks like this 'AB000114.CDS.1', i.e. Some letters followed by some numbers. The .CDS. part is kind of optional.
  22. How many human genes with SwissProt IDs in orphans.sp exist ? How many of those are hypothetical ? (11)
  23. How many genes belong to the rat, and how many of those are precursors ? (9) Note: A Swissprot ID looks like 'PARG_HUMAN' or 'TF1A_MOUSE', with the gene being before the underscore and the organism after the underscore.
  24. From the file ex1.res find the lines with positive numbers and put then into ex1.pos. The lines with negative number go into ex1.neg.
  25. Calculate ((356+51)*123-12765)/56 on the command line. Design your command so when you press ENTER to execute, it computes the result and shows the prompt waiting for your next command.

Exercises for extra practice