essential components for a trading platform:

  1. User Interface (UI):
    • Dashboard: A user-friendly interface that provides real-time market data, account information, and a customizable layout.
    • Order Entry System: Allows users to place, modify, and cancel orders easily.
    • Charting Tools: Advanced charting tools for technical analysis, with features like indicators, drawing tools, and timeframes.
  2. Market Data Feed:
    • Real-Time Data: Integration with reliable market data sources to provide up-to-date information on prices, volumes, and market depth.
    • Historical Data: Access to historical price and volume data for backtesting and analysis.
  3. Order Management System (OMS):
    • Order Routing: Efficient routing of orders to various exchanges or liquidity providers.
    • Order Types: Support for various order types, such as market orders, limit orders, stop orders, and more.
  4. Risk Management:
    • Position Monitoring: Real-time tracking of open positions and exposure.
    • Risk Controls: Implement risk management features to prevent large losses, such as setting position limits, stop-loss orders, and margin requirements.
  5. Account Management:
    • User Authentication: Secure login and authentication mechanisms.
    • Account Information: Display of account balances, transaction history, and other relevant details.
  6. Execution Management System (EMS):
    • Algorithmic Trading: Support for algorithmic and automated trading strategies.
    • Smart Order Routing: Efficiently route orders to achieve best execution across multiple venues.
  7. Compliance and Regulation:
    • Compliance Tools: Ensure adherence to regulatory requirements and compliance standards.
    • Audit Trail: Maintain a detailed log of all trading activities for regulatory reporting.
  8. Security:
    • Encryption: Use encryption protocols to secure communication and data transmission.
    • Authentication and Authorization: Implement strong authentication mechanisms and access controls.
  9. Notification and Reporting:
    • Alerts: Provide alerts for price movements, order executions, and other relevant events.
    • Reporting Tools: Generate detailed reports on trading activity, performance, and tax-related information.
  10. Customer Support:
    • Support System: Integration with customer support tools to address user queries and issues.
  11. Scalability and Performance:
    • High Throughput: Ensure the platform can handle a large number of transactions and users simultaneously.
    • Low Latency: Minimize order execution times for optimal performance.
  12. APIs (Application Programming Interfaces):
    • Open APIs: Provide APIs for third-party integrations, allowing developers to build custom tools and algorithms.

Building a trading platform involves compliance with financial regulations, security standards, and a deep understanding of the financial markets. It’s crucial to stay updated on industry trends and continuously enhance the platform’s features based on user feedback and market dynamics.

LINUX Cheat Sheet

1 – SYSTEM INFORMATION

uname -a# Display Linux system informationuname -r# Display kernel release informationcat /etc/redhat-release# Show which version of Red Hat installeduptime# Show how long the system has been running + loadhostname# Show system host namehostname -I# Display all local IP addresses of the hostlast reboot# Show system reboot historydate# Show the current date and timecal# Show this month’s calendarw# Display who is onlinewhoami# Who you are logged in as

2 – HARDWARE INFORMATION

dmesg# Display messages in kernel ring buffercat /proc/cpuinfo# Display CPU informationcat /proc/meminfo# Display memory informationfree -h# Display free and used memory ( ​-h​ for human readable,-m​ for MB, ​-g​ for GB.)lspci -tv# Display PCI deviceslsusb -tv# Display USB devicesdmidecode# Display DMI/SMBIOS (hardware info) from the BIOShdparm -i /dev/sda# Show info about disk sdahdparm -tT /dev/sda# Perform a read speed test on disk sdabadblocks -s /dev/sda# Test for unreadable blocks on disk sdaLINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com2

3 – PERFORMANCE MONITORING AND STATISTICS

top# Display and manage the top processeshtop# Interactive process viewer (top alternative)mpstat 1# Display processor related statisticsvmstat 1# Display virtual memory statisticsiostat 1# Display I/O statisticstail -100 /var/log/messages# Display the last 100 syslog messages (Use/var/log/syslog​ for Debian based systems.)tcpdump -i eth0# Capture and display all packets on interface eth0tcpdump -i eth0 ‘port 80’# Monitor all traffic on port 80 ( HTTP )lsof# List all open files on the systemlsof -u user# List files opened by ​userfree -h# Display free and used memory ( -h for humanreadable, -m for MB, -g for GB.)watch df -h# Execute “df -h”, showing periodic updates

4 – USER INFORMATION AND MANAGEMENTid# Display the user and group ids of yourcurrent user.last# Display the last users who have logged ontothe system.who# Show who is logged into the system.w# Show who is logged in and what they aredoing.groupadd test# Create a group named “test”.useradd -c “John Smith” -m john# Create an account named john, with acomment of “John Smith” and create the user’shome directory.userdel john# Delete the john account.usermod -aG sales john# Add the john account to the sales groupLINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com3

5 – FILE AND DIRECTORY COMMANDSls -al# List all files in a long listing (detailed) formatpwd# Display the present working directorymkdir directory# Create a directoryrm file# Remove (delete) filerm -r directory# Remove the directory and its contentsrecursivelyrm -f file# Force removal of file without prompting forconfirmationrm -rf directory# Forcefully remove directory recursivelycp file1 file2# Copy file1 to file2cp -r source_directory destination# Copy ​source_directory​ recursively todestination​. If destination exists, copysource_directory​ into ​destination​,otherwise create ​destination​ with thecontents of ​source_directory​.mv file1 file2# Rename or move ​file1​ to ​file2​. If file2 isan existing directory, move file1 into directoryfile2ln -s /path/to/file linkname# Create symbolic link to ​linknametouch file# Create an empty file or update the accessand modification times of file.cat file# View the contents of ​fileless file# Browse through a text filehead file# Display the first 10 lines of ​filetail file# Display the last 10 lines of ​filetail -f file# Display the last 10 lines of ​file​ and “follow”the file as it grows.LINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com4

6 – PROCESS MANAGEMENT

ps# Display your currently running processesps -ef# Display all the currently running processes on thesystem.ps -ef | grep processname# Display process information for ​processnametop# Display and manage the top processeshtop# Interactive process viewer (top alternative)kill pid# Kill process with process ID of p​idkillall processname# Kill all processes named ​processnameprogram &# Start ​program​ in the backgroundbg# Display stopped or background jobsfg# Brings the most recent background job toforegroundfg n# Brings job ​n​ to the foreground

7 – FILE PERMISSIONS

PERMISSION EXAMPLE U G W rwx rwx rwx chmod 777 filename # Use sparingly! rwx rwx r-x chmod 775 filename rwx r-x r-x chmod 755 filename rw- rw- r– chmod 664 filename rw- r– r– chmod 644 filenameLINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com5

LEGEND U = User G = Group W = World r = Read w = write x = execute – = no access

8 – NETWORKING

ip a# Display all network interfaces and IP addressip addr show dev eth0# Display eth0 address and detailsethtool eth0# Query or control network driver and hardware settingsping host# Send ICMP echo request to ​hostwhois domain# Display whois information for ​domaindig domain# Display DNS information for ​domaindig -x IP_ADDRESS# Reverse lookup of ​IP_ADDRESShost domain# Display DNS IP address for ​domainhostname -i# Display the network address of the host name.hostname -I# Display all local IP addresses of the host.wget http://domain.com/file# Download ​http://domain.com/filenetstat -nutlp# Display listening tcp and udp ports and correspondingprograms

9 – ARCHIVES (TAR FILES)

tar cf archive.tar directory# Create tar named ​archive.tar​ containingdirectory​.tar xf archive.tar# Extract the contents from ​archive.tar​.tar czf archive.tar.gz directory# Create a gzip compressed tar file namearchive.tar.gz​.LINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com6

tar xzf archive.tar.gz# Extract a gzip compressed tar file.tar cjf archive.tar.bz2 directory# Create a tar file with bzip2 compressiontar xjf archive.tar.bz2# Extract a bzip2 compressed tar file.

10 – INSTALLING PACKAGES

yum search keyword# Search for a package by ​keyword​.yum install package# Install ​package​.yum info package# Display description and summary informationabout ​package​.rpm -i package.rpm# Install package from local file namedpackage.rpmyum remove package# Remove/uninstall ​package​.tar zxvf sourcecode.tar.gzcd sourcecode./configuremakemake install# Install software from source code.

11 – SEARCH

grep pattern file# Search for ​pattern​ in ​filegrep -r pattern directory# Search recursively for ​pattern​ in ​directorylocate name# Find files and directories by namefind /home/john -name ‘prefix*’# Find files in ​/home/john​ that start with “prefix”.find /home -size +100M# Find files larger than 100MB in /home

12 – SSH LOGINS

ssh host# Connect to ​host​ as your local username.ssh user@host# Connect to ​host​ as ​userssh -p port user@host# Connect to ​host​ using ​portLINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com7

13 – FILE TRANSFERS

scp file.txt server:/tmp# Secure copy ​file.txt ​to the /tmp folder onserverscp server:/var/www/*.html /tmp# Copy ​*.html​ files from ​server​ to the local/tmp folder.scp -r server:/var/www /tmp# Copy all files and directories recursively fromserver​ to the current system’s /tmp folder.rsync -a /home /backups/# Synchronize ​/home​ to​ /backups/homersync -avz /home server:/backups/# Synchronize files/directories between the localand remote system with compression enabled

14 – DISK USAGE

df -h# Show free and used space on mounted filesystemsdf -i# Show free and used inodes on mounted filesystemsfdisk -l# Display disks partitions sizes and typesdu -ah# Display disk usage for all files and directories inhuman readable formatdu -sh# Display total disk usage off the current directory

15 – DIRECTORY NAVIGATION

cd ..# To go up one level of the directory tree. (Change intothe parent directory.)cd# Go to the $HOME directorycd /etc# Change to the /etc directoryLINUX COMMAND LINE CHEAT SHEET ​https://www.LinuxTrainingAcademy.com8

Linux Networking related commands

Contents

ip. 1

ip link. 1

ip address. 1

ip route. 1

nmap. 2

ping. 3

iPerf. 3

traceroute. 4

tcpdump. 5

netstat. 5

ss. 6

ssh. 7

scp and sftp. 8

Ifconfig. 9

dig. 9

telnet. 10

nslookup. 10

ip

The iproute2 package includes the IP command which is used for network and routing configuration. This replaces the traditional ifconfig and route commands.

ip takes a second argument that specifies the object on which you wish to execute a command and an action like add, delete, or show.

ip link

ip link is for configuring, adding, and deleting network interfaces. Use ip link show command to display all network interfaces on the system :

$ ip link show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000

    link/ether 02:35:97:08:6b:2a brd ff:ff:ff:ff:ff:ff

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000

    link/ether 08:00:27:6f:60:ff brd ff:ff:ff:ff:ff:ff

You can see the man page for ip link with:

$ man  ip-link

ip address

Use ip address command to display addresses, bind new address or delete old ones. The man page ip address command is named as ip-address.

For example, the following command shows the IP address assigned to the network interface enp0s8:

ip address show dev enp0s8

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    link/ether 08:00:27:6f:60:ff brd ff:ff:ff:ff:ff:ff

    inet 10.0.0.51/24 brd 10.0.0.255 scope global enp0s8

ip route

Use the IP route to print or display the routing table. The following command displays the contents of the routing table:

$ ip route show

default via 10.0.2.2 dev enp0s3

10.0.0.0/24 dev enp0s8  proto kernel  scope link  src 10.0.0.51

10.0.2.0/24 dev enp0s3  proto kernel  scope link  src 10.0.2.15

nmap

While Nmap had been used in many movies,  The Matrix Reloaded (Wikipedia, IMDB, Amazon) turned Nmap into a movie star!.

Nmap (“Network Mapper”) is a powerful utility used for network discovery, security auditing, and administration. Many system admins use it to determine which of their systems are online, and also for OS detection and service detection. 

The default Nmap scan shows the ports, their state (open/closed), and protocols. It sends a packet to 1000 most common ports and checks for the response.

$ nmap 10.0.0.50

Starting Nmap 7.01 ( https://nmap.org ) at 2020-09-07 10:32 UTC

Nmap scan report for 10.0.0.50

Host is up (0.00077s latency).

Not shown: 997 filtered ports

PORT     STATE  SERVICE

22/tcp   open   ssh

80/tcp   open   http

3306/tcp closed mysql

To check which hosts on your network are up:

$ nmap -sn 10.0.0.0/24

Starting Nmap 7.01 ( https://nmap.org ) at 2020-09-07 11:59 UTC

Nmap scan report for 10.0.0.1

Host is up (0.00084s latency).

Nmap scan report for 10.0.0.50

Host is up (0.0021s latency).

Nmap scan report for 10.0.0.51

Host is up (0.00026s latency).

Nmap done: 256 IP addresses (3 hosts up) scanned in 2.61 seconds

Use -O flag to identify which operating system a host is running.

$ sudo  nmap 10.0.0.50 -O

Starting Nmap 7.01 ( https://nmap.org ) at 2020-09-07 13:44 UTC

Nmap scan report for 10.0.0.50

Host is up (0.00053s latency).

Running: Linux 3.X

OS CPE: cpe:/o:linux:linux_kernel:3

OS details: Linux 3.10 – 3.19

Network Distance: 1 hop

OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .

Nmap done: 1 IP address (1 host up) scanned in 21.95 seconds

A word of caution: Nobody appreciates their systems being scanned over the internet. So before you do so, seek permission.

You can also use Nmap on Windows, check out this installation guide.

ping

Use ping to see if a host is alive. This super simple command helps you check the status of a host or a network segment. Ping command sends an ICMP ECHO_REQUEST packet to the target host and waits to see if it replies.

However, some hosts block ICMP echo requests with a firewall. Some sites on the internet may also do the same.

By default, ping runs in an infinite loop. To send a defined number of packets, use -c flag.

$ ping -c 3 google.com

PING google.com (172.217.167.238): 56 data bytes

64 bytes from 172.217.167.238: icmp_seq=0 ttl=118 time=7.898 ms

64 bytes from 172.217.167.238: icmp_seq=1 ttl=118 time=7.960 ms

64 bytes from 172.217.167.238: icmp_seq=2 ttl=118 time=6.247 ms

— google.com ping statistics —

3 packets transmitted, 3 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 6.247/7.368/7.960/0.793 ms

With -o flag ping exits successfully after receiving one reply packet.

$ ping -o google.com

PING google.com (172.217.167.46): 56 data bytes

64 bytes from 172.217.167.46: icmp_seq=0 ttl=118 time=7.540 ms

— google.com ping statistics —

1 packets transmitted, 1 packets received, 0.0% packet loss

round-trip min/avg/max/stddev = 7.540/7.540/7.540/0.000 ms

You can use -n flag to avoid reverse DNS lookups. The ICMP sequence number is particularly important. A Break in sequence numbers indicates lost packets.

A failed ping could be due to

  • network failure
  • host being not alive
  • firewall blocking ICMP ECHO requests

You can also perform an online ping test to check the connectivity from different parts of the world.

iPerf

While ping verifies the availability of a host, iPerf helps analyze and measure network performance between two hosts. With iPerf, you open a connection between two hosts and send some data. iPerf then shows the bandwidth available between the two hosts.

You can install an iPerf using your distribution package manager. For example on Ubuntu-based distributions you can install like this:

$ sudo apt install iperf -y

Once you have installed iPerf on both the machines, start the iPerf server on one of them. The following example starts the iPerf server on a host with IP address 10.0.0.51.

$ iperf -s

————————————————————

Server listening on TCP port 5001

TCP window size: 85.3 KByte (default)

————————————————————

On the second machine start iPerf with the -c flag. This connects with the server and sends some data.

$ iperf -c 10.0.0.51

————————————————————

Client connecting to 10.0.0.51, TCP port 5001

TCP window size: 85.0 KByte (default)

————————————————————

[  3] local 10.0.0.50 port 42177 connected with 10.0.0.51 port 5001

[ ID] Interval       Transfer     Bandwidth

[  3]  0.0-10.0 sec  1.13 GBytes   972 Mbits/sec

iPerf returns with the bandwidth results in a few seconds.

traceroute

If ping shows missing packets, you should use traceroute to see what route the packets are taking.  Traceroute shows the sequence of gateways through which the packets travel to reach their destination. For example, traceroute from my machine to google.com shows the following:

$ traceroute google.com

traceroute to google.com (172.217.167.46), 64 hops max, 52 byte packets

 1  dlinkrouter.dlink (192.168.0.1)  5.376 ms  2.076 ms  1.932 ms

 2  10.194.0.1 (10.194.0.1)  5.190 ms  5.125 ms  4.989 ms

 3  broadband.actcorp.in (49.207.47.201)  7.165 ms  5.749 ms  5.755 ms

 4  broadband.actcorp.in (49.207.47.225)  5.918 ms *  8.483 ms

 9  108.170.251.97 (108.170.251.97)  6.359 ms

    del03s16-in-f14.1e100.net (172.217.167.46)  5.448 ms

    108.170.251.97 (108.170.251.97)  6.400 ms

Line 4 in this output shows a * in the round trip times. This indicates no response was received. This can be due to many reasons – as the traceroute ICMP packets are low-priority, these may be dropped by a router. Or there could be simply congestion.  If you see a * in all the time fields for a given gateway, then possibly the gateway is down.

Many web-based route tracing tools allow you to do a reverse traceroute, that is, from a website to your host. You can check these at traceroute.org or Geekflare Traceroute.

tcpdump

tcpdump is a packet sniffing tool and can be of great help when resolving network issues. It listens to the network traffic and prints packet information based on the criteria you define.

For example, you can examine all packets sent to or from a particular host, Ubuntu18 in this example:

$ sudo tcpdump host ubuntu18 -n -c 5

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes

14:12:11.509092 IP 10.0.0.4.22 > 183.83.208.234.9633: Flags [P.], seq 2991049004:2991049112, ack 2956233368, win 501, options [nop,nop,TS val 292041322 ecr 405604219], length 108

14:12:11.509146 IP 10.0.0.4.22 > 183.83.208.234.9633: Flags [P.], seq 108:252, ack 1, win 501, options [nop,nop,TS val 292041322 ecr 405604219], length 144

14:12:11.509218 IP 10.0.0.4.22 > 183.83.208.234.9633: Flags [P.], seq 252:288, ack 1, win 501, options [nop,nop,TS val 292041322 ecr 405604219], length 36

14:12:11.509259 IP 10.0.0.4.22 > 183.83.208.234.9633: Flags [P.], seq 288:500, ack 1, win 501, options [nop,nop,TS val 292041322 ecr 405604219], length 212

14:12:11.509331 IP 10.0.0.4.22 > 183.83.208.234.9633: Flags [P.], seq 500:768, ack 1, win 501, options [nop,nop,TS val 292041322 ecr 405604219], length 268

5 packets captured

6 packets received by filter

0 packets dropped by kernel

By default, tcpdump resolves IP addresses to hostnames. Use -n flag, if you do not want tcpdump to perform name lookups.

tcpdump output prints one line for each packet. Use -c flag to limit output, 5 in the example above.

tcpdump is useful for solving network problems and also identifying potential problems. It is a good idea to run a tcpdump on your network occasionally to verify everything is in order.

netstat

Netstat command is used to examine network connections, routing tables, and various network settings and statistics.

Use -i flag to list the network interfaces on your system.

Here is an example:

$ netstat -i

Kernel Interface table

Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg

eth0       1500 0      4001      0      0 0          2283      0      0      0 BMRU

eth1       1500 0     27154      0      0 0        838962      0      0      0 BMRU

lo        65536 0         0      0      0 0             0      0      0      0 LRU

Using -r flag will display the routing table. This shows the path configured for sending network packets.

$ netstat -r

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

default         10.0.2.2        0.0.0.0         UG        0 0          0 eth0

10.0.0.0        *               255.255.255.0   U         0 0          0 eth1

10.0.2.0        *               255.255.255.0   U         0 0          0 eth0

An asterisk in the last two lines indicates that no gateway is required to send packets to any host on these networks. This host is directly connected to the networks 10.0.0.0 and 10.0.2.0.

In the first line, the destination is the default, which means any packet destined for a network not listed in this table is handled by the router 10.0.2,2.

netstat command without any options displays a list of open sockets. Use -l flag to show only listening sockets, which by default, are not shown. You can use -a flag to show listening and non-listening sockets. Here is an example:

$ netstat -a

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State     

tcp        0      0 *:ssh                   *:*                     LISTEN    

tcp        0     36 10.0.2.15:ssh           10.0.2.2:51017          ESTABLISHED

tcp6       0      0 [::]:ssh                [::]:*                  LISTEN    

udp        0      0 *:bootpc                *:*                               

Active UNIX domain sockets (servers and established)

Proto RefCnt Flags       Type       State         I-Node   Path

unix  3      [ ]         DGRAM                    8186     /run/systemd/notify

More Netstat command example here

ss

Linux installations have a lot of services running by default. These should be disabled or preferably removed, as this helps in reducing the attack surface. You can see what services are running with the netstat command. While netstat is still available, most Linux distributions are transitioning to ss command.

use ss command with -t and -a flags to list all TCP sockets. This displays both listening and non-listening sockets.

$ ss -t -a

State       Recv-Q Send-Q            Local Address:Port                Peer Address:Port  

LISTEN      0      128                           *:sunrpc                         *:*      

LISTEN      0      128                           *:http                           *:*      

LISTEN      0      128                           *:ssh                            *:*      

LISTEN      0      128                           *:60031                          *:*      

ESTAB       0      0                     10.0.2.15:ssh                     10.0.2.2:51699   

ESTAB       0      0                     10.0.2.15:ssh                     10.0.2.2:51049  

LISTEN      0      128                          :::sunrpc                        :::*      

LISTEN      0      128                          :::http                          :::*      

LISTEN      0      128                          :::ssh                           :::*      

LISTEN      0      128                          :::54715                         :::*

To display only TCP connections with state established:

ss -a -t -o state established

Recv-Q Send-Q                 Local Address:Port                     Peer Address:Port  

0      0                          10.0.2.15:ssh                          10.0.2.2:51699    timer:(keepalive,23min,0)

0      0                          10.0.2.15:ssh                          10.0.2.2:51049    timer:(keepalive,114min,0)

ssh

ssh enables you to connect securely with remote hosts over the internet. Earlier rlogin and telnet were used to connect to and administer remote hosts. However, both suffer from a fundamental flaw, that is, they send all information including login names and passwords in cleartext.

ssh enables secure communication over the internet with the following two features :

  • It confirms that the remote host is, who it says it is.
  • It encrypts all communication between the hosts.

To connect to a remote host you need to have an OpenSSH server running on the remote host. You can install it using your distribution package manager. For example on Ubuntu you can install it like this:

$ sudo apt install openssh-server

Here is an example showing how you can connect to the remote host 10.0.0.50 using the ssh command:

me@ubuntu-xenial:~$ ssh 10.0.0.50

The authenticity of host ‘10.0.0.50 (10.0.0.50)’ can’t be established.

ECDSA key fingerprint is SHA256:s2tNJQa/C1/W0SevGm7Rt3xoBZG1QL5yT3ff/+PMpnY.

Are you sure you want to continue connecting (yes/no)? yes

You get a message saying that the authenticity of the host 10.0.0.50 cannot be established, this is because it’s the first time a connection is being made with 10.0.0.50 (server) and the ssh client has never seen this remote host before. Enter yes to continue connecting. Once the connection has been established, you are prompted for a password:

Warning: Permanently added ‘10.0.0.50’ (ECDSA) to the list of known hosts.

me@10.0.0.50’s password:

After you enter the correct password, you are logged into the remote host.

Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 3.13.0-170-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

..

me@vagrant-ubuntu-trusty-64:~$

You can exit this remote shell with the exit command.

Also, you can easily execute a single command on the remote host using ssh. For example, to run df -h on the remote host:

$ ssh 10.0.0.50 df -h

me@10.0.0.50’s password:

Filesystem      Size  Used Avail Use% Mounted on

udev            241M   12K  241M   1% /dev

tmpfs            49M  384K   49M   1% /run

/dev/sda1        40G  1.6G   37G   5% /

none            224G  113G  111G  51% /vagrant

me@ubuntu-xenial:~$

scp and sftp

scp (secure copy) is very similar to cp command for copying files, with an addition – you can include remote hostnames in the source or destination pathnames. The hostname and the directory path are separated by a colon. This enables you to copy files securely over the network in an encrypted form. The following command copies a.txt from the local machine to 10.0.0.50 :

me@ubuntu-xenial:~$ scp a.txt 10.0.0.50:/home/me

me@10.0.0.50’s password:

a.txt                                           100%    0     0.0KB/s   00:00

sftp (secure ftp) is also a file copy program similar to ftp. However, it uses an SSH encrypted tunnel to copy files, instead of sending everything in cleartext. Also, you do not need an FTP server running on the remote host. You only need an ssh server. Here is an example session:

me@ubuntu-xenial:~$ sftp 10.0.0.50

me@10.0.0.50’s password:

Connected to 10.0.0.50.

sftp> put kali-linux-2020.3-installer-netinst-i386.iso

Uploading kali-linux-2020.3-installer-netinst-i386.iso to /home/me/kali-linux-2020.3-installer-netinst-i386.iso

kali-linux-2020.3-installer-netinst-i386.iso    100%  435MB  27.2MB/s   00:16   

sftp> bye

Ifconfig

Mostly we use ifconfig command to check the IP address assigned to the system.

[root@lab ~]# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 209.97.137.171  netmask 255.255.240.0  broadcast 209.97.143.255

        inet6 fe80::c035:b2ff:fe9d:72d5  prefixlen 64  scopeid 0x20<link>

        ether c2:35:b2:9d:72:d5  txqueuelen 1000  (Ethernet)

        RX packets 1333200  bytes 167143230 (159.4 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 979666  bytes 93582595 (89.2 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 16  bytes 1392 (1.3 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 16  bytes 1392 (1.3 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lab ~]#

dig

dig (Domain Information Groper) is a flexible tool for interrogating DNS name servers.

It performs DNS lookups and displays the answers that are returned from the name servers.

[root@lab ~]# dig geekflare.com

; <<>> DiG 9.11.13-RedHat-9.11.13-5.el8_2 <<>> geekflare.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12310

;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 512

;; QUESTION SECTION:

;geekflare.com.                IN      A

;; ANSWER SECTION:

geekflare.com.         30      IN      A       104.27.119.115

geekflare.com.         30      IN      A       104.27.118.115

;; Query time: 12 msec

;; SERVER: 67.207.67.2#53(67.207.67.2)

;; WHEN: Wed Sep 16 17:58:45 UTC 2020

;; MSG SIZE  rcvd: 74

[root@lab ~]#

telnet

telnet connect destination’s host and port via a telnet protocol if a connection establishes means connectivity between two hosts is working fine.

[root@lab ~]# telnet gf.dev 443

Trying 104.27.153.44…

Connected to gf.dev.

Escape character is ‘^]’.

nslookup

nslookup is a program to query domain name servers and resolving IP.

[root@lab ~]# nslookup relicflare.com

Server:        67.207.67.2

Address:       67.207.67.2#53

Non-authoritative answer:

Name:   relicflare.com

Address: 192.64.119.178

[root@lab ~]#

Linux Basic Commands

Here is a list of basic Linux commands:

  1. pwd command

Use the pwd command to find out the path of the current working directory (folder) you’re in. The command will return an absolute (full) path, which is basically a path of all the directories that starts with a forward slash (/). An example of an absolute path is /home/username.

  1. cd command

To navigate through the Linux files and directories, use the cd command. It requires either the full path or the name of the directory, depending on the current working directory that you’re in.

Let’s say you’re in /home/username/Documents and you want to go to Photos, a subdirectory of Documents. To do so, simply type the following command: cd Photos.

Another scenario is if you want to switch to a completely new directory, for example,/home/username/Movies. In this case, you have to type cd followed by the directory’s absolute path: cd /home/username/Movies.

There are some shortcuts to help you navigate quickly:

cd .. (with two dots) to move one directory up
cd to go straight to the home folder
cd- (with a hyphen) to move to your previous directory

On a side note, Linux’s shell is case sensitive. So, you have to type the name’s directory exactly as it is.

  1. ls command

The ls command is used to view the contents of a directory. By default, this command will display the contents of your current working directory.

If you want to see the content of other directories, type ls and then the directory’s path. For example, enter ls /home/username/Documents to view the content of Documents.

There are variations you can use with the ls command:

ls -R will list all the files in the sub-directories as well
ls -a will show the hidden files
ls -al will list the files and directories with detailed information like the permissions, size, owner, etc.
  1. cat command

cat (short for concatenate) is one of the most frequently used commands in Linux. It is used to list the contents of a file on the standard output (sdout). To run this command, type cat followed by the file’s name and its extension. For instance: cat file.txt.

Here are other ways to use the cat command:

cat > filename creates a new file
cat filename1 filename2>filename3 joins two files (1 and 2) and stores the output of them in a new file (3)
to convert a file to upper or lower case use, cat filename | tr a-z A-Z >output.txt
  1. cp command

Use the cp command to copy files from the current directory to a different directory. For instance, the command cp scenery.jpg /home/username/Pictures would create a copy of scenery.jpg (from your current directory) into the Pictures directory.

  1. mv command

The primary use of the mv command is to move files, although it can also be used to rename files.

The arguments in mv are similar to the cp command. You need to type mv, the file’s name, and the destination’s directory. For example: mv file.txt /home/username/Documents.

To rename files, the Linux command is mv oldname.ext newname.ext

  1. mkdir command

Use mkdir command to make a new directory — if you type mkdir Music it will create a directory called Music.

There are extra mkdir commands as well:

To generate a new directory inside another directory, use this Linux basic command mkdir Music/Newfile
use the p (parents) option to create a directory in between two existing directories. For example, mkdir -p Music/2020/Newfile will create the new “2020” file.
  1. rmdir command

If you need to delete a directory, use the rmdir command. However, rmdir only allows you to delete empty directories.

  1. rm command

The rm command is used to delete directories and the contents within them. If you only want to delete the directory — as an alternative to rmdir — use rm -r.

Note: Be very careful with this command and double-check which directory you are in. This will delete everything and there is no undo.

  1. touch command

The touch command allows you to create a blank new file through the Linux command line. As an example, enter touch /home/username/Documents/Web.html to create an HTML file entitled Web under the Documents directory.

  1. locate command

You can use this command to locate a file, just like the search command in Windows. What’s more, using the -i argument along with this command will make it case-insensitive, so you can search for a file even if you don’t remember its exact name.

To search for a file that contains two or more words, use an asterisk (). For example, locate -i schoolnote command will search for any file that contains the word “school” and “note”, whether it is uppercase or lowercase.

  1. find command

Similar to the locate command, using find also searches for files and directories. The difference is, you use the find command to locate files within a given directory.

As an example, find /home/ -name notes.txt command will search for a file called notes.txt within the home directory and its subdirectories.

Other variations when using the find are:

To find files in the current directory use, find . -name notes.txt
To look for directories use, / -type d -name notes. txt
  1. grep command

Another basic Linux command that is undoubtedly helpful for everyday use is grep. It lets you search through all the text in a given file.

To illustrate, grep blue notepad.txt will search for the word blue in the notepad file. Lines that contain the searched word will be displayed fully.

  1. sudo command

Short for “SuperUser Do”, this command enables you to perform tasks that require administrative or root permissions. However, it is not advisable to use this command for daily use because it might be easy for an error to occur if you did something wrong.

  1. df command

Use df command to get a report on the system’s disk space usage, shown in percentage and KBs. If you want to see the report in megabytes, type df -m.

  1. du command

If you want to check how much space a file or a directory takes, the du (Disk Usage) command is the answer. However, the disk usage summary will show disk block numbers instead of the usual size format. If you want to see it in bytes, kilobytes, and megabytes, add the -h argument to the command line.

  1. head command

The head command is used to view the first lines of any text file. By default, it will show the first ten lines, but you can change this number to your liking. For example, if you only want to show the first five lines, type head -n 5 filename.ext.

  1. tail command

This one has a similar function to the head command, but instead of showing the first lines, the tail command will display the last ten lines of a text file. For example, tail -n filename.ext.

  1. diff command

Short for difference, the diff command compares the contents of two files line by line. After analyzing the files, it will output the lines that do not match. Programmers often use this command when they need to make program alterations instead of rewriting the entire source code.

The simplest form of this command is diff file1.ext file2.ext

  1. tar command

The tar command is the most used command to archive multiple files into a tarball — a common Linux file format that is similar to zip format, with compression being optional.

This command is quite complex with a long list of functions such as adding new files into an existing archive, listing the content of an archive, extracting the content from an archive, and many more. Check out some practical examples to know more about other functions.

  1. chmod command

chmod is another Linux command, used to change the read, write, and execute permissions of files and directories. As this command is rather complicated, you can read the full tutorial in order to execute it properly.

  1. chown command

In Linux, all files are owned by a specific user. The chown command enables you to change or transfer the ownership of a file to the specified username. For instance, chown linuxuser2 file.ext will make linuxuser2 as the owner of the file.ext.

  1. jobs command

jobs command will display all current jobs along with their statuses. A job is basically a process that is started by the shell.

  1. kill command

If you have an unresponsive program, you can terminate it manually by using the kill command. It will send a certain signal to the misbehaving app and instructs the app to terminate itself.

There is a total of sixty-four signals that you can use, but people usually only use two signals:

SIGTERM (15) — requests a program to stop running and gives it some time to save all of its progress. If you don’t specify the signal when entering the kill command, this signal will be used.
SIGKILL (9) — forces programs to stop immediately. Unsaved progress will be lost.

Besides knowing the signals, you also need to know the process identification number (PID) of the program you want to kill. If you don’t know the PID, simply run the command ps ux.

After knowing what signal you want to use and the PID of the program, enter the following syntax:

kill [signal option] PID.

  1. ping command

Use the ping command to check your connectivity status to a server. For example, by simply entering ping google.com, the command will check whether you’re able to connect to Google and also measure the response time.

  1. wget command

The Linux command line is super useful — you can even download files from the internet with the help of the wget command. To do so, simply type wget followed by the download link.

  1. uname command

The uname command, short for Unix Name, will print detailed information about your Linux system like the machine name, operating system, kernel, and so on.

  1. top command

As a terminal equivalent to Task Manager in Windows, the top command will display a list of running processes and how much CPU each process uses. It’s very useful to monitor system resource usage, especially knowing which process needs to be terminated because it consumes too many resources.

  1. history command

When you’ve been using Linux for a certain period of time, you’ll quickly notice that you can run hundreds of commands every day. As such, running history command is particularly useful if you want to review the commands you’ve entered before.

  1. man command

Confused about the function of certain Linux commands? Don’t worry, you can easily learn how to use them right from Linux’s shell by using the man command. For instance, entering man tail will show the manual instruction of the tail command.

  1. echo command

This command is used to move some data into a file. For example, if you want to add the text, “Hello, my name is John” into a file called name.txt, you would type echo Hello, my name is John >> name.txt

  1. zip, unzip command

Use the zip command to compress your files into a zip archive, and use the unzip command to extract the zipped files from a zip archive.

  1. hostname command

If you want to know the name of your host/network simply type hostname. Adding a -I to the end will display the IP address of your network.

  1. useradd, userdel command

Since Linux is a multi-user system, this means more than one person can interact with the same system at the same time. useradd is used to create a new user, while passwd is adding a password to that user’s account. To add a new person named John type, useradd John and then to add his password type, passwd 123456789.

To remove a user is very similar to adding a new user. To delete the users account type, userdel UserName
Bonus Tips and Tricks

Use the clear command to clean out the terminal if it is getting cluttered with too many past commands.

Try the TAB button to autofill what you are typing. For example, if you need to type Documents, begin to type a command (let’s go with cd Docu, then hit the TAB key) and the terminal will fill in the rest, showing you cd Documents.

Ctrl+C and Ctrl+Z are used to stop any command that is currently working. Ctrl+C will stop and terminate the command, while Ctrl+Z will simply pause the command.

If you accidental freeze your terminal by using Ctrl+S, simply undo this with the unfreeze Ctrl+Q.

Ctrl+A moves you to the beginning of the line while Ctrl+E moves you to the end.

You can run multiple commands in one single command by using the “;” to separate them. For example Command1; Command2; Command3. Or use && if you only want the next command to run when the first one is successful.

SQL-certification path

OLTP and OLAP

OLTP – Online Transaction processing – inserts , updates and deletes very efficient and fast, OLAP (Online Analytical processing – Data Warehouse) – data insert not efficient, reading data is efficient

Indexes are used to retrieve data from the database more quickly than otherwise. The users cannot see the indexes, they are just used to speed up searches/queries. Note: Updating a table with indexes takes more time than updating a table without

Most db starts their life as OLTP,

Challenges in balncing number of indexes , usefulness and to keep data useful for both query types.

When the data volume (business grows) increases it becomes impossible to manage with just OLTP and the solution is to maintain two different database structures which makes data retrieval efficient.

Thats how OLAP is born when business get big and we need to improve effieciency of retrieval.

CRUD- create, read, update and delete (insert, select, update and delete)

ACID – Atomicity, Consistency,Isolation and Durability

Normalization – Process of organizing data to minimize redundancy and remove ambiguity.

Commit – SQL command that marks transaction successful

rollback – SQL command that marks transaction unsuccessful

Datatypes – An attribute that specifies the type of data that the object can hold

(DDL and DML )Statement Types

DDL – CREATE, ALTER, DROP and TRUNCATE
DML – SELECT,INSERT, UPDATE and DELETE