Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I connect to my school server using the terminal.

I try to run my main.c on their computer.

but I do not know how to do it.

Should I copy the files to my school and then run or something else ?

what are the commands I need to write after I connect to school computers.

(school = university).

share|improve this question
    
What do you mean run main.c ? Display the source code ? Or you want to compile, then run the program ? –  NorTicUs Oct 26 '12 at 9:18
    
I want to compile the code and then run it –  wantToLearn Oct 26 '12 at 9:26
add comment

1 Answer 1

So I assume you are logging in via ssh, using some command like: ssh user@host.address.com.

In that case first you have to copy your main.c to the remote machine:

scp main.c user@host.address.com:/home/homefolder/subfolder/main.c

Of course you have to replace some strings in this command. So "user" in the above command needs to be replaced with the right user name on your universities' server. Same goes for "host.address.com" which is supposed to be the login URL of your schools' server. Finally "/home/homefolder/subfolder/main.c" denotes the location you want to copy your file to.

Once done you can open a remote terminal as usual and cd into the directory that now has your main.c like this:

ssh user@host.address.com
cd /home/homefolder/subfolder/main.c
gcc -Wall main.c -o mainprogram
./mainprogram

The last two lines compile your c-Code and run it. Insted of gcc (the GNU compiler collection) your school might use another compiler such as the Intel C Compiler, icc.

share|improve this answer
    
I did what you told and it did not help because the terminal told permission denied (publickey, pasword). he also said stdin is not a terminal –  wantToLearn Oct 26 '12 at 10:09
    
Then you entered the wrong password. Its ab bit too little information you are giving us here. Your University must have a tutorial on how these things work. Maybe you should consult that. For more detailed error messages you can use ssh -vv user@host.address.com and edit your answer to include the messages that shows. –  con-f-use Oct 26 '12 at 10:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.