Monday, June 4, 2007

PA5 FAQ1

PA5 FAQ1
By Mock

-----
QUESTION:
On a CSIL machine, how do I copy files from one directory to another?

ANSWER:
[Option 1]
Let's say you are in the destination directory. You want to copy all the files from ~teliot/PA5/ to the current directory. You can do this:
cp -r ~teliot/PA5/* .
The option -r stands for "recursively". It will copy all files and subdirectories from the source directory to the current directory. (Remember that the dot (".") stands for "current directory", and ".." stands for "the parent of current directory".)
[Option 2]
Let's say you are already in the source directory. You want to create a directory in your home directory called myPA5 and copy everything from the current directory to ~/myPA5. (Remember that ~ stands for "home". So, ~ is your home. ~teliot is home of teliot.) You can do this:
mkdir ~/myPA5
cp -r * ~/myPA5

-----
QUESTION:
What program can I use to transfer files between my home computer and CSIL?

ANSWER:
You can use the freely available WinSCP or FileZilla clients for PCs. For Macs, you can use Cyberduck (also free). Open the program and connect to csil.cs.ucsb.edu, using your own username and password. We do not officially support or endorse these programs. But I'm happy to help during my office hours if you are curious.

-----
QUESTION:
Can I write my program in Windows and upload it to CSIL? What could be a problem?

ANSWER:
No you should not. Dr Jacobson wants you to practice programming in Unix. You must make sure your code is readable in Unix (by cat, more, or less). The code must compile and the program must work in Unix.

But if you work in Windows, will we know it? The honest answer is "it depends."

One thing to keep in mind. Windows uses a combination of CR (Carriage Return, ASCII #13) and LF (Line Feed, ASCII #10) to represent new line. Unix uses only LF. So, if you open a Notepad-written file in Unix, you will see funny characters at the end of line. If you open a pico-written file in Windows, you will see all the lines crammed together.

How to fix this? Again, we do not support it. But these are two useful unix commands:
dos2unix [filename]
unix2dos [filename]
You can look at the man page for usage.

-----

No comments: