This article will get you a good spark about writing the programs in various languages like Ruby, PHP, Python, Perl, Bash, C, C++ and Java.
All Credits goes to Mr. Chetan Soni – A Cyber Security Expert from India.
1. Ruby – Ruby is totally a dynamic, reflective and object oriented language and was developed in 1990s. In ruby, everything is an expression and everything is executed imperatively. There are 4 levels of Variable Scopes i.e. Global, Class, Instance, and Local. Ruby is managed by centralized package management through RubyGems.
[-] Starting Program 1 (Hello Readers) –
#first program
puts “Hello Readers”
Here # denotes the comments.
[-] Starting Program 2 (Date and Time) –
#date and time
puts “Current Date is ” + Time.now.strftime(‘%Y-%m-%d’)
puts “Current Time is ” + Time.now.strftime(‘%H:%M:%S’)
2. Python – Python is created by Guido Van Rossum by 1991 and is widely used in high level programming functions. Python has a dynamic type system and automatic memory management and having large and comprehensive standard library.
The latest version of python is 3.6.0, you can download python from below link –
https://www.python.org/downloads/
To run the program,
python hello.py
[-] Starting Program 1 (Hello Readers) –
#!/usr/bin/python
print(“Hello Readers”)
Here # denotes the comments.
[-] Starting Program 2 (Date and Time) –
#!/usr/bin/python
import time
print (time.strftime(“%H:%M:%S”))
print (time.strftime(“%d/%m/%Y”))
========================================================================
3. PHP – PHP is the server side language which is widely used for general purpose scripting for web development for making dynamic and interactive web pages.
The current version of PHP is 7.1.1(Stable). To download PHP, please click the below link –
http://php.net/downloads.php
And recently by 19th January 2017, they just released an emergency security update for versions 5.6.30, 7.0.15 and 7.1.1
[-] Starting Program 1 (Hello Readers) –
<?php
echo “Hello Readers”;
?>
[-] Starting Program 2 (Date and Time) –
<?php
echo “Current date is “.date(‘Y-m-d’, time()).”\n”;
echo “Current time is “.date(‘H:M:S’, time()).”\n”;
?>
Here \n denotes New Line.
========================================================================
4. PERL – PERL was orginally developed by Larry Wall in 1987 and was known as Unix Scripting Language. PERL 5 is a highly capable, feature-rich programming language with over 29 years of development.
The current stable version of PERL is 5.24.0 and is fully available for windows/linux/Mac. To download PERL, please click the below link –
https://www.perl.org/get.html
[-] Starting Program 1 (Hello Readers) –
#!/usr/bin/perl
print ‘Hello Readers’;
[-] Starting Program 2 (Date and Time) –
#!/usr/local/bin/perl
$datestring = localtime();
print “Current date and time is $datestring”;
========================================================================
5. JAVA – Java is the language designed to run on any platform. It is a general purposed language that is concurrent and class based. In 1991, James Gosling, Mike Sheridan and Patrick Naughton intiated this java project and was intitally designed for interactive television.
[-] Starting Program 1 (Hello Readers) –
public class HelloReaders
{
public static void main(String[] args)
{
System.out.println(“Hello Readers”);
}
}
[-] Starting Program 2 (Date and Time) –
Date d = new Date(System.currentTimeMillis());
System.out.println(d);
Here we created a local object of date with named “d”.
OR
Date date = Calendar.getInstance().getTime();
System.out.println(date);
========================================================================
6. C – C language was originally developed by Dennis Ritchie at Bell Labs. It was designed to be compiled using a relatively straightforward compiler and is widely used for system programming including implementing Operating systems and embedded systems applications.
To compile any program, you can use GCC Compiler,
gcc hello.c -o hello.bin
To run compiled program,
./hello.bin
[-] Starting Program 1 (Hello Readers) –
#include
int main(void) {
printf(“Hello Readers”);
return 0;
}
[-] Starting Program 2 (Date and Time) –
#include
#include
void main()
{
time_t t;
time(&t);
clrscr();
printf(“Today’s date and time : %s”,ctime(&t));
getch();
}
========================================================================
7. C++ – In 1979, Bjarne Stroustrup, a Danish Computer scientist, began work on C with Classes and in 1983, C with Classes was renamed to C++ and in 1985, the first version of “The C++ Programming Language” was released. Encapsulation and Inheritance are the most popular features of C++ Language.
To compile any C++ Program, you can use G++ Compiler.
g++ hello.cpp -o execute
./execute
[-] Starting Program 1 (Hello Readers) –
#include
int main () {
std::cout << “Hello Readers” << std::endl;
}
[-] Starting Program 2 (Date and Time) –
#include “date.h”
#include
int main()
{
using namespace date;
using namespace std::chrono;
std::cout << system_clock::now() << ‘\n’;
}
Here \n denotes New Line.
========================================================================
8. BASH – Bash is a Unix shell and command language written by Brian Fox in 1988 and is now the default interactive shell for all linux distributions.
[-] Starting Program 1 (Hello Readers) –
#!/bin/bash
echo “Hello Readers”
[-] Starting Program 2 (Date and Time) –
You may also like:#!/bin/sh
echo “Current date is `date +”%Y-%m-%d”`”
echo “Current time is `date +”%H:%M:%S”`”
- Top Skills Needed to Become a Cybersecurity Analyst
- Mastering Windows Management with WMIC Commands – Top 20 Examples
- Edit and Compile Code with the Best 5 Code Editors
- 50+ Top DevSecOps Tools You Need To Know
- Learn How to Add Proxy and Multiple Accounts in MoreLogin
- Some Useful PowerShell Cmdlets
- Create Free SSL Certificate – ZEROSSL.COM [2020 Tutorial]
- Generate Self-Signed SSL Certificate with OPENSSL in Kali Linux
- RDP – CredSSP Encryption Oracle Remediation Solution 2020
- Scan Open Ports using Ss, Netstat, Lsof and Nmap