Horje
How to Run C program in Ubuntu?

In the technological era, to execute Linux-based applications, Ubuntu is a popular Linux-based operating system to produce all the operations. Programmers can accomplish a wide range of required tasks with the comprehensive collection of functions and macros that the C programming language offers with its large function library facility. Open-source software development ideas served as the cornerstone for all the system design choices made in the creation of the Ubuntu program or terminal system.

In this article, we’ll explore the initial steps to write, compile, and run a C program in Ubuntu.

How to Run C program in Ubuntu?

To compile and run a C program on the Ubuntu operating system via a file, we require the GCC compiler in our internal system. One of the build-essential packages that produces the various activities that we need to install from the Ubuntu repository is the GCC Compiler. We must develop our C program in an Integrated Development Environment (IDE) like Visual Studio Code or a basic text editor which can compile and run all of the programs after installing the build-essential package. We must then compile and run our C program by creating a file on the terminal.

Now, follow the below-mentioned easy steps to run and compile a C program in Ubuntu.

Step 1: Install GCC compiler on Ubuntu

  • Install the GCC compiler on the Ubuntu operating system > Check the GCC compiler installation status by using the below command
$ gcc -version
version_gcc

Step 2: Implement touch command

  • Use the touch command on the terminal > Create a C program file
$ touch hello.c

Step 3: Write a C program on the file

  • Open the file named hello.c > Write a basic C program

Let’s see the hello.c program –

C
#include <stdio.h>

int main() {

    // code
  printf("Hello world");
    return 0;
}

Output
Hello world
hellochello_World_program

Step 4: Compile the hello.c program

  • Go to the program file > Compile hello.c file
  • Use gcc hello.c command in the terminal > Generate hello executable file in the Ubuntu system terminal
gcc_hello

Step 5: Run the hello executable file

  • Use ./hello command in the environment > Run the hello executable file in the terminal on Ubuntu
hello_world_main

Now, we can see the actual output of Hello World in our terminal of the hello.c system file.

Conclusion

For executing Linux-based applications, Ubuntu is a popular Linux-based operating system in today’s technology. In addition to offering an adaptable and open-source platform for a variety of internal applications and professional industries, it allows all users to customize the system. All we need to do is write our C program in a text editor create a file, compile it, and run it in the terminal after installing the build-essential package by following the proper steps. This simple procedure enables all the users to begin using C programming in Ubuntu.

Also Read

How to Run C program in Ubuntu – FAQs

What is Ubuntu in today’s technology?

Ubuntu is an open-source system environment, free operating system (OS) that may be used on a variety of gadgets, such as internal servers, systems or laptops, smartphones, tablets, and cloud computing technology. It is the most common Linux workstation platform to produce multiple systems in the world and is based on the famous Linux distribution Debian environment. There are several versions of Ubuntu available, including as Desktop, Server, and Core for Internet of Things or IoT gadgets and robotics technologies.

Why Ubuntu is better than Windows OS as per users’ preferences?

Ubuntu is often chosen over Windows operating systems by the users due of its free and open-source nature. It features a sizable software library accessibility, enhanced system security, stability, ease of updating, and community support throughout the network. It is a well-liked option for Linux users and developers due to all of these special characteristics over Windows.

What do you mean by Network bonding in Ubuntu OS?

NIC teaming is another name for network bonding system environment. Connecting two or more internal network interfaces to a single interface is a type of bonding technology. Usually, by boosting all the required network bandwidth and throughput, it enhances the system redundancy and overall performance.

How to run the Ubuntu terminal efficiently?

We can follow some easy steps to run Ubuntu terminal efficiently, which are –

  • To open a terminal window in Ubuntu, press Ctrl+Alt+T > Go to the Distributions.
  • Go and use the Dash to search for > launch the Terminal application system.
  • Press Alt+F2 from the keyboard > Type “gnome-terminal” to open the internal terminal window through the Run a Command dialog.



Reffered: https://www.geeksforgeeks.org


TechTips

Related
How to Install Grafana Loki on Ubuntu? How to Install Grafana Loki on Ubuntu?
How to Create a Microsoft Account in Windows 11? How to Create a Microsoft Account in Windows 11?
Installation and configuration of DHCP server on UBUNTU Installation and configuration of DHCP server on UBUNTU
How to Install Nextcloud on Ubuntu? How to Install Nextcloud on Ubuntu?
Remote Server Management from the Ubuntu Terminal Remote Server Management from the Ubuntu Terminal

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
34