XML

kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for unix

2007

Question 11 (2007):

Submission reference: IN1299

I'm a Unix newbie. How do you specify a USB device on the Unix command line? I have a simple requirement to copy a file from a USB device to a file in my home directory.

Answer 11:

I'll assume you're using Linux, and that you have a working USB stack (not generally an issue these days). Before you can access files on a device (such as a hard-disk or USB stick), you have to mount it somewhere. E.g. the root file-system is mounted on "/". Look at the contents of /etc/fstab to see where other things are mounted. USB sticks will typically appear as SCSI devices when plugged in, such as "sda" or "sdb" (or whatever, depending on how many SCSI devices are already there). When you plug the stick in, the kernel will utter something useful at you. Run "dmesg" to see the kernel log, and check the last couple of lines, which should be USB related. In particular, you should see something like "sda" or "sdb". Then mount it, e.g. "mount /dev/sda1 /media/usb -t vfat" (you may need to be root to do this). Once there, you can copy out the files from "/media/usb". Note that you mount "sda1", not "sda"; the former refers to a particular partition on the device. Once you're done copying files, don't forget to unmount: "umount /media/usb".

The above doesn't sound terribly nice, but that's Unix for you -- however, the possibilities of what you can do with it are pretty endless. Some Unixes are nicer... On my Debian system, for instance, when I plug in a USB stick it automatically mounts it and pops up a file-explorer type window.

Keywords: unix

2004

Question 40 (2004):

Can I access kroc and exceed from parkwood ? If yes, how do I access them ?

Answer 40:

Yes, you can do this. It should simply be a case of installing eXceed then launching the "CS Unix Hosts" icon (which is an eXceed session file). You can install eXceed from `\\corfe\install\' or `\\corfe\packages\' (iirc). Failing that ask on the newsgroups; I'm sure lots of people have done this successfully before.

Keywords: unix , exceed


Question 37 (2004):

I am trying to run programs from the answers folder in \\raptor\files\courses\co516\answers, but from the Unix system I can't seam to get there. On the comand line after typing the "ls" comand I get (understanding that I'm now in the "\\raptor\files\home" folder):

    raptor$ ls
    bluej        core         Desktop          Work documents
    raptor$

and typing

    raptor$ cd ..

to get to "\\raptor\files" dosen't seam to work. Using the "ls" comand I get a list of users in the system. "cd"-ing to my username just gets me back to "\\raptor\files\home"!

    raptor$ ls
    aa206          cr49           jg38           mjf27          rjb7
    :
    .  (a lot more users)
    raptor$

What I want to know is how to get to the "\\raptor\files\courses\co516\answers" folder in Unix.

Answer 37:

The Unix file-system starts at "/", and everything else hangs off it. The "\\raptor\files\" style of path naming is very much Windows-specific. Files on raptor are visible from Windows by means of `Samba' -- some software that understands the SMB protocol. The point is that there is no director "\files\" on raptor -- this is generated magically by Samba (clearly not everyone can have the same home-directory!).

The actual Unix path of your home-directory is "/home/cut/login/". The handy Unix command "pwd" will tell you which directory you're in. The Unix path of the model answers is "/usr/local/courses/co516/answers/", so to get there you'd type:

    raptor$ cd /usr/local/courses/co516/answers
    raptor$

from which "ls" should produce something more meaningful (ie, the model answers).

I find it very handy to have the directory I'm in displayed in the command-prompt. To do this, edit your "~/.bash_profile" file (where the tilde (~) means your home-directory), and add the line:

    PS1='\h:\w:$?$ '

(at the end of the file would be sensible). This particular rune will give you a prompt that looks like:

    raptor:/home/cur/frmb:0$

The path to your home directory will often be shortened to `~', so you might see stuff like:

    raptor:~:0$

instead of the full path. The zero in that lot is generated by the `$?' bit -- this shell variable gives the result of the last executed command, which can be very handy to tell whether something succeeded (and exits with zero), or failed (and exits with non-zero).

Keywords: unix


Question 25 (2004):

Just some feedback,

Maybe you should have started the CO516 class with a few UNIX commands we'd need for occam since most of us have never used it before, CO501 never covered UNIX much in the first 4 weeks and the extra UNIX sessions so far have been 2 lectures and 1 class. Hardly enough to help us run and compile occam programs.

Also maybe instead of the first couple of terminal sessions getting us to correct `bugs.occ' (which we found hard as we hadn't done occam before so took a long time) it would have been better to have had more classes such as `demo.occ' to run and compile and maybe several programs with small errors rather than one big one with lots of errors.

Answer 25:

Thanks!

The Co516 did start off by getting you logged in to Unix (on raptor) and showing you how to navigate through your file store. Before coming to the classes, you were supposed to have followed the "occam setup information" link on the Co516 web page and copied over the examples and exercises directories to you home area. In the class, those who had not done this were nursed though it. You were then told to read through the various README files ... particularly the one in examples ... which explains how to compile and run occam programs.

That information is all you need to start work. Here it is again. To compile an occam source code file called "thing.occ", the command is "kroc thing.occ". This produces either compiler error messages or the compiled executable called "thing". To run your compiled executable, the command is "thing". Usually. Some users do not have the current directory in their command search path - in which case, "thing" produces a response saying that that command cannot be found. In which case, to run your compiled executable, the command is "./thing" (which tells the system to look in ".", your current directory, for the file "thing" and run it).

That's all there is to it! And that's what has been shown to you in the classes since week 2. If you didn't know, why are you asking now and not then. It's not possible to have been doing the work without knowing this. There are no other Unix skills needed. You need to be able to edit text files, of course, and there are several Unix editors on offer. But you can simply use your favourite Windows editor since you can operate on your (raptor) files from Windows.

The "bugs.occ" file consists of 23 lines of code. It's got lots of errors but it's not exactly big! Compiling/editing it was supposed to be a game hiding some solid learning experience. You just need the course slides in front of you and the "occam2 Checklist" paper and some enjoyment at solving puzzles ... it should never have taken two whole terminal sessions.

It seems that some students view the classes as the time when you do these exercises. That's true but, in between classes, is no further work done on them? You are supposed to put in several hours work in your own time for every one hour lecture. Apart from working on the computer, reading is essential ... through the course slides and the papers at the end of the course notes. The "occam Approach to Transputer Engineering" is an easy read, and goes through many of the lessons presented in the slides and lectures. There is also "Fred Barnes' occam tutorial", linked off the Co516 web page. Currently (Week 5), you are supposed to be reading the file "sort_pump.occ" in your examples directory. This follows the lecture last Tuesday. You need to study particularly the processes key.mix, window and layout. How many are doing this? To get ahead, look also at screen.mix ... but this requires an occam construct, the ALT, which we haven't done yet in the lectures.

Any problem you discover in your understanding of the subject, that you can't solve by asking your colleagues, can be asked on these pages -- but please check the keyword index first! Have you all looked at questions 1 through 9 (and their answers) from the "Year 2000-2001"? Lots of the questions asked this year already have answers there. There are also chunks of code directly relevant to answering Q1.

Finally, please bring specific problems that remain outstanding to the leaders in your terminal classes or, from next week (Week 6), your seminar groups.

Keywords: unix

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:34 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.