Lab 3: More UNIX:
Provide your answers in the spaces next to the questions. To begin, create
a directory lab3/ in your home directory, then cd to it.
- (preliminary) Download (save link/page ) the file rasmol
to your home directory. This is a program to visualize biomolecules.
- (preliminary) Download (save link/page ) the file 1BDD.pdb to your home directory. This is a biomolecule - a protein from staphylococcus bacterium. (Don't worry, in electronic form it is harmless.)
IMPORTANT: This exercise will work best if you download the above (Linux) executable directly on your laptop. Intense graphical applications are typically slow when done over the internet. Linux/Mac users can try to ssh -Y (or -X) directly onto the lab machine, but as I said, the graphics will probably be slow. Windows users who did not yet install Linux are stuck at this point. The
only possible solution is to download a windows version of rasmol
that is called raswin
.
- (1 point ) Type ./rasmol 1BDD.pdb Why doesn't the viewer window open?
What needs to be done to fix the problem?
- (1 point) Now do ./rasmol 1BDD.pdb, go to "Display" pull-down menu and select "Cartoons". How many helices (these look like thick matress springs ) does your protein have?
- (1 point) In the above command, did you use a relative or absolute path
to rasmol? (next question is for unix buffs:) Why it may not generally be a good idea to just do rasmol 1BDD.pdb in this situation?
- (preliminary) Create a directory structure under lab3 as follows
(the names with a / are directories and all others are files).
Take care to pay attention to the indentation, which reflects the nesting
of subdirectories.
- midwest/
- eastcoast/
- illinois/
- northwestern
- indiana/
- purdue
- notredame
- westcoast/
- california/
- berkeley
- stanford
- rockies/
- (2 points) By mistake, the midwestern states and their universities have been listed under
eastcoast. We are now trying to move the misplaced directories and their contents
together to the correct location, so that the directory structure looks like:
- midwest/
- illinois/
- northwestern
- indiana/
- purdue
- notredame
- eastcoast/
- westcoast/
- california/
- berkeley
- stanford
- rockies/
Write a mv command to achieve the desired effect. Note that the mv command implicitly
recurses through the given arguments so you can move entire directory trees (in contrast,
the cp and rm commands require the -r option to recursively copy to a new location or
recursively delete from a given location).
Before answering this question, first cd into the lab3 directory. Then type your mv
command from here. Write your command here below.
- (4 points) Once again assume that you are now in the lab3 top-level directory. Write ls commands to list :
- the universities (not states or regions) that have the character "n" in them.
- the universities (not states or regions) that start with the character "n".
- the universities (not states or regions) that have at least three vowels.
- the states (but not their contents).
You can assume that states are those directories at the second level of nesting.
The regular expressions that you concoct must perform their intended roles in any directory
system, not just for the example directory system given here. You are also not allowed to
solve the questions yourself and explicitly list the answers in the ls command.
- (2 points) Create two files called oldfile and newfile. Put some random text in each of
them. Make sure the contents are different so that it will help you in debugging and
understanding what is to follow. Then explain what each of the following four commands
below do.
(In answering this question, it will help you to inspect the contents of the relevant files
both before and after the command is executed, so that you can systematically try to infer
what is going on.)
- cat oldfile
- cat oldfile newfile
- cat oldfile > newfile
- cat > newfile