Frequent Question: How Do I Run Gcc on Ubuntu?
Contents

How do I run a gcc program in Ubuntu?

To open the Terminal, you can use the Ubuntu Dash or the Ctrl+Alt+T shortcut.

  1. Step 1: Install the build-essential packages. …
  2. Step 2: Write a simple C program. …
  3. Step 3: Compile the C program with gcc Compiler. …
  4. Step 4: Run the program.

How do I run a gcc file in Terminal?

Answer

  1. Write your code in your favorite editor: In the terminal, type nano yourcode. …
  2. Back to the terminal, navigate to where your C file is stored. (Reminder: ls to list directory contents, cd to change directory.)
  3. Compile your code with gcc -o program yourcode. c .
  4. Execute it with ./program . Done!
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest