Hello World Python3, Bash, C, C++, Go, Lua, Ruby, Java – Programming Languages on Ubuntu 18.04

Hello world! All programs start with a hello world. It tests that your environment is working, so that you can run your code.

This is how you install and run the most important languages on Linux: Python 3, Bash, C, C++, Go, Lua, Ruby and Java.

Tested on Ubuntu 18.04 LTS (Xubuntu). All languages installed with apt-get, from default repositories.

Python 3

$ cat hellotero.py
print("Hello Tero")
$ python3 hellotero.py
Hello Tero


$ cat hellotero.sh
echo "Hello Tero"
$ bash hellotero.sh
Hello Tero


$ cat hellotero.c
#include <stdio.h>
int main()
 printf("Hello Tero\n");
$ gcc hellotero.c -o helloteroc
$ ./helloteroc
Hello Tero

C++ (cpp)

$ cat hellotero.cc
#include <iostream>

int main()
 std::cout << "Hello Tero\n";
$ g++ hellotero.cc -o helloterocc
$ ./helloterocc
Hello Tero


$ cat HelloTero.java   # filename must match class name
public class HelloTero
 public static void main(String[] args)
 System.out.println("Hello Tero");
$ javac HelloTero.java
$ java HelloTero   # do not write .class here
Hello Tero


$ sudo apt-get -y install golang-go
$ cat hellotero.go
package main

import "fmt"

func main() {
 fmt.Printf("Hello Tero\n")
$ go build -o helloterogo hellotero.go
$ ./helloterogo
Hello Tero


$ cat hellotero.rb
print ("Hello Tero\n")
$ ruby hellotero.rb
Hello Tero


$ cat hellotero.lua
print("Hello Tero")
$ lua hellotero.lua
Hello Tero
Posted in Uncategorized | Tagged , , , , , , , , , , , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Recent Posts

  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects