Steps for implementing C language Hello world in Linux

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.