Recently. I started to learn about Linux. The following describes how to implement Hello world in Linux:
Attach the basic process
[Crazw @ Linux ~] $ Lscode documents Music Public templates Information Security competition report .doc desktop downloads pictures software videos [crazw @ Linux ~] $ CD code/[crazw @ Linux Code] $ ls [crazw @ Linux Code] $ mkdir Hello [crazw @ Linux Code] $ lshello [crazw @ Linux Code] $ vim. /Hello/hello. c [crazw @ Linux Code] $ GCC hello. c-o hellogcc: Error: Hello. c: No such file or directorygcc: Fatal error: no input filescompilation terminated. [crazw @ Linux Code] $ CD Hello [crazw @ Linux Hello] $ GCC hello. c-o Hello [crazw @ Linux Hello] $. /hellohelllo world
J. Next I will explain each step in detail:
First, use Vim to create a. c file.
In the code folder, create a new Hello folder and use Vim to see a hello. c file:
[crazw@Linux ~]$ cd code/[crazw@Linux code]$ ls[crazw@Linux code]$ mkdir hello[crazw@Linux code]$ lshello
Then, press "I" to enter the editing mode: After the basic code is written, Press ESC and then press ": WQ". This is to save and exit the command. W: Save. Q: exit. (This is the basic operation of VI. )
Use GCC to compile and generate an executable file named hello.
[crazw@Linux code]$ cd hello[crazw@Linux hello]$ gcc hello.c -o hello
Finally, execute the hello file to check the result:
[crazw@Linux hello]$ ./helloHelllo world
Okay. Learn about Linux. I hope you will not try it.