| |
cd ~ |
Get the ~ tilde by holding down shift and hitting the ` key.
It's right under the escape key. This is a shortcut to say "go to my home directory" |
mkdir your_name |
Create a directory with your name to keep your files together. |
cd your_name |
Go into the new directory |
nano hello.c |
Create a new file called "hello.c".
When nano comes up, type in the "Hello World" program
(look here).
When you're done, hit control-x to exit...
and tell it that, yes, you wish to save,
and the filename is really still hello.c
(you'll see the prompts at the bottom). |
gcc hello.c -o hello |
Now use the "gcc" compiler to turn your program into an executable!
Just like that. If the compiler has any problems, it will let you know.
If it succeeds and there are no problems, you'll just get another prompt. |
./hello |
Now try running the executable. Note the "dot slash" in front of it.
The period means "this directory."
Normally you can't run commands from the current directory.
The dot-slash just tells the computer,
"This command is in the current directory." |