AWS vs Azure vs GCP vs HUAWEI Cloud

aws vs azure vs gcp vs huawei cloud



1.  AWS Services

a. Elastic Compute Cloud (EC2)

b. Elastic Beanstalk

c. Lambda 

d. Elastic Container Service

e. Auto Scaling

f. Simple Storage Service

g. Elastic Block Storage

h. Cloud Front

i. RDS

j. DynamoDB

k. VPC

l. Direct Connect

m. Route 53

n. Cloud Trail

o. Cloud Watch

p. Identity Access and Management (IAM)

q. Cloud HSM

r. Kinesis

s. OpsWorks

t. Cloud Formation

u. Simple Notification Service

v. Elastic Load Balancing


2.  Azure Services

a. Virtual Machine

b. Cloud Services

c. Functions

d. Container Service

e. Autoscale

f. BLOB Storage

g. Manage Storage

h. CDN

i. SQL Database

j. DocumentDB

k. Virtual Networks

l. Express Route

m. Traffic Manager

n. Operational Insights

o. Application Insights

p. Azure Active Directory

q. Azure Trust Center

r. Stream Analytics

s. Automation

t. Resource Manager

u. Notification Hub

v. Load Balancing


3.  GCP

a. Compute Engine

b.Google App Engine

c. Cloud Functions

d. Container Edge

e. Autoscaler

f. Cloud Storage

g. Persistent Disk

h. Cloud CDN

i. Cloud SQL

j. Cloud Datastore

k. Cloud Virtual Network

l. Cloud Interconnect

m. Cloud DNS

n. Cloud Logging

o. Stack driver Monitoring

p. Cloud Identity Access and Management (IAM)

q. Google Cloud Platform Security

r. Cloud Dataflow

s. Compute Engine Management

t. Cloud Deployment Management

u.  

v. Cloud Load Balancing


4.  HUAWEI CLOUD

a. Elastic Compute Server

b. Service Stage

c. Function Graph

d. Cloud Container Engine

e. Auto Scaling

f. Object Storage Service

g. Elastic Volume Service

h. Cloud Delivery Network

i. RDS

j. Document Database Service

k. Virtual Private Cloud

l. Direct Connect

m. Cloud DNS

n. Cloud Trace

o. Cloud Eye

p. Identity Access and Management 

q. Data Encryption Workshop

r. Data Ingestion Service

s. Cloud Service Engine

t. Application Orchestration Service

u. Simple Message Notification

v. Elastic Load Balancing

Kubernetes vs Dockerswarm

docker swarm vs kubernetes



What is Kubernetes?

Kubernetes is software for container orchestration, that is  used to manage a large number of containers on physical infrastructure. Kubernetes was designed by Google .

Key Kubernetes features include service discovery and load balancing, storage orchestration, rollback and self healing for container clusters, permissions, and configuration management.

What is Docker Swarm?

Docker Swarm allows you to manage Docker engine clusters locally within the Docker platform. You can use the Docker cli to create a cluster, deploy application services to the cluster, and manage the cluster behaviour.

Docker Swarm helps coordinate containers and assign tasks to container groups. Docker Swarm also performs health checks, manages the lifecycle of a single container, provides redundancy and failure in the event of a node failure, performs rolling software updates, and scales containers up and down according to actual load.

Kubernetes vs. Docker Swarm: Key Differences

Docker Swarm and Kubernetes are the two most widely used open source platforms for container orchestration, and appear to provide almost identical functionality. However, after careful consideration, there are some basic differences. We’ve broken the differences down by features, below.

Setup/Installation & Cluster Strength

Docker Swarm is known to have the more quick and simple setup and installation process. Swarm is also easier to pick up, even with less technical knowledge. Kubernetes on the other hand is much more complex to install . However, because of this, Kubernetes is also able to handle far larger or more complicated deployments. Once you’re past the initial install and get the hang of how it works, Kubernetes offers stronger clusters that are faster and more secure in large production environments.

Supernova: It depends on your system needs! Smaller, simpler infrastructures can thrive with Docker Swarm. But if you’re looking for flexible growth and the ability to handle extremely complex systems, Kubernetes is the way to go.

GUI (Graphical User Interface)

Kubernetes comes with its own GUI built right in. The Kubernetes Dashboard allows you to easily scale and deploy individual applications, as well as control and monitor your different clusters. Docker Swarm does not have a built-in GUI. However, there are several third party tools available to supplement this as needed.

Supernova: Kubernetes

Scalability

Both Kubernetes and Docker Swarm allow you to more easily scale up or down your infrastructure  depending on your needs. While Kubernetes does add automated scaling which can adjust based on traffic, Docker Swarm requires all scaling to be done manually. However! Container scaling and deployment is slowed down by Kubernetes’ more complex framework.

Supernova: Again, this depends on what matters more to you when it comes to scalability. If you’re looking for automation, then Kubernetes might be your best bet. But if speed when scaling up or down is more important to your team, then you may prefer Docker Swarm.

Load Balancing (LB)

Docker Swarm blaze when it comes to load balancing (LB)  because of how it is easily automated within Docker containers. Kubernetes requires manual configuration of LB within the different nodes.

Supernova: Docker Swarm

Logging & Monitoring

With the Kubernetes dashboard, logging and monitoring is built-in available. There are also many third party monitoring tools that can be added to track additional key metrics. While Docker Swarm does come with some basic server log and event tools from Docker, third party apps are a must to really get the most out of your monitoring.

Supernova: Kubernetes

Future Outlook

Docker was acquired in November 2019 by Mirantis, which has caused some concern among Docker Swarm users. Mirantis has stated they will continue support for Docker Swarm without any implied end date, though many are left feeling unsure about the future of Docker Swarm. Because of this, many Swarm users are beginning to start planning a migration to Kubernetes, which is in Google hands.

Supernova: Kubernetes

Networking

Kubernetes: The networking model is a flat network, allowing all pods to interact with one another. The network policies specify how the pods interact with each other. The flat network is implemented typically as an overlay. The model needs two CIDRs: one for the services and the other from which pods acquire an IP address.

Docker Swarm: The Node joining a swarm cluster generates an overlay network for services that span every host in the docker swarm and a host-only docker bridge network for containers. The users have a choice to encrypt container data traffic while creating of an overlay network by on their own in docker swarm.

Advantages and Disadvantages of Kubernetes

Advantages:

  • Trusted, open-source platform backed by Google with a large community of users
  • Works smoothly on all operating systems
  • Able to manage large and complex infrastructures
  • Highly scalable with flexible room for growth
  • Automated, self-healing features
  • Large community of users

Disadvantages:

  • Installation is complex and set up has a steeper learning curve
  • Requires separate Compose and Command Line Interface (CLI) tools

Advantages and Disadvantages of Docker Swarm

Advantages:

  • Open-source platform that works perfectly with all existing Docker products
  • Installation is quick and simple
  • Great for smaller and less complex systems

Disadvantages:

  • Can be limited in functionality as it’s tied to Docker’s API
  • Future of Docker Swarm is unsure following the Mirantis acquisition

Conclusion

Kubernetes supports higher demands with more complex Environment while Docker Swarm offers a simple solution that is easy and quick to get started with. Docker Swarm has been quite popular among developers who prefer fast deployments and simplicity. Simultaneously, Kubernetes is utilized in production environments by various high profile internet firms running popular services.


Learn Basic Linux in 10 days

 Day No. 1

---------

What is an OS

It is a program which controls hardware

(cpu, ram, hard disk, nic, keyboard, mouse, terminal)

What are the common OS in the market

UNIX (

WIndows (XP, 7, 8, )

2000, 2003, 2008, 2012

MacOS - Mac (Apple) 

OS/400 (IBM) - AS/400

MainFrame (IBM)


Theory : UNIX History

AT &T, Bell Labs, C - 1967

AIX (IBM), 

Solaris (Sub)

HP-UX (HP)

IRIS (Silicon Graphics)

DEC (Digital)

Linux - x86 - Intel, AMD (open source) 

Linux Distros (Red Hat, SuSe, CentOS, Fedora, Ubuntu)

Open Source

License, Subscription


Command : echo

echo "Hello world"

echo 'Hello world'

echo Hello world

echo Hello             world

echo 'Hello             world'

echo -e '\n\nHello\nWorld\n'

echo -e '\n\nHello\tWorld\n'

Command : clear

Command : alias

alias cls='clear'

alias

unalias cls

Note: alias will last only for a session

Shortcuts : ctrl + l 

Command : whoami 

Command : id

Display UID, GID of promary group and GIDs of all seconday groups

Command : date 

date -s to set the time of the server - can be run as root

What is a UNIX date : 01-01-1970

date +%D

date +%Y

date +%m

date +%d

date +%d.%m.%Y

date +%d-%m-%Y

Command : cal

cal

cal 1960

cal 5 2014

Command : uname 

uname

uname -r

uname -a

Note: architecture,64bit/32it,machinename, 

Command : man

man date

man crontab

man 5 crontab

man -k keyword

Command : ifconfig 

ifconfig

Note: ip addr, mac addr, netmask, name of ethernet card given by SA

Command : uptime

Command : who 

Command : w 

Note: JCPU, PCPU, IP Address, What

Command : users 

Command : hostname

hostname -s

Command : history

history -c

export HISTSIZE=5000

Note: These commands are stored in a file named .bash_history

!20 <== execute 20th command from your history

ctrl + r  <== search at the command prompt

Command : exit

Shortcuts : ctrl + d    

Command : ping

ping yahho.com

ping -c2 192.168.0.254

Command : ssh 

ssh aaftab@172.24.0.240

ssh -l aaftab 172.24.0.240

ssh -X aaftab@172.24.0.240 <== For opening graphical commands (firefox)  

Command : last

Command : write 

Command : wall 

Shortcuts : ctrl + shift + n

Shortcuts : ctrl + shift + t

Shortcuts : ctrl + shift + +   

Enlarge font

Shortcuts : ctrl + -

Reduce font

Shortcuts : up arrow

previous command

Shortcuts : down arrow

next command




Day No. 2

---------

Command : pwd 

Command : cd 

cd  <== goes to your home dir

cd .. <== goes to your parent dir

cd . <== . mean current directory

cd ~ <= goes to your home dir

cd ~aaftab <= goes you aaftab's home directory

cd ~aaftab/bin <= goes to bin directory which is under aaftab's home dir

cd / <== go to the top most dir

cd - <== go to previous directory

Theory : Filesystem (Directory structure)

/

/bin

/etc

/home

/sbin

/root

/tmp

/usr/bin

Command : ls

ls -l  <= long listing sorted from a-z

name

time on which the file/dir was last modified

size of a file/dir

group owner

owner/user

no of links

permissions ( owner, members of group owner, others)

file type (- file, d dir, l link, s socket, c char device, b block device)

devcices (mouse, keyboard, disks, disk partition, terminal/window, usb)

ls -a <== all - mean show hidden files (hidden file starts with a .)

ls -t <== list of files sorted by time

ls -r <== list of files sorted by i reverse order

ls -i <== Display inode number of each file


ls -l .

ls -l $HOME

ls -l ~

ls -l ..

ls -l ../..

ls -l ~oracle


ls -ld /home/aaftab <== display the info of the direcrory and not what is inside that directory


Theory : What is inode (index Node). It is structure. A table with info of a file

name, timestamps, owner, group owner, perm, size, 


Symbol : ?

Symbol : *

Command : cat 

cat /home/arununix/dir1/abhi.txt 

cat abhi.txt

cat ./abhi.txt

cat -n abhi.txt

cat -n /etc/passwd


Command : su

su - arununix  <== will ask you arununix's password

su - root <== will ask you root's password

su -   <== will ask you root's password


Command : more

more /etc/passwd 

space bar <== display next page

enter key <== display next line

Command : less

less /etc/passwd 

space bar <== display next page

enter key <== display next line

/aaftab <== search the word 'aaftab' in the file

q <== exit from the file

Command : head 

head /etc/passwd <== display top 10 lines of /etc/passwd file

head -6 /etc/passwd <== display top 6 lines of /etc/passwd file

Command : tail 

tail /etc/passwd <== display last 10 lines of /etc/passwd file

tail -6 /etc/passwd <== display last 6 lines of /etc/passwd file

tail -f /etc/passwd <== display last few lines contineously

tail -n +2 /etc/passwd <== display all lines from bottom except the top two

Command : touch

Command : cp 

cp /etc/passwd /home/aaftab/mypasswd

cp /etc/passwd  ./mypasswd

cp /etc/passwd .  <= . means pwd

cp /etc/passwd ./bin

cp /etc/passwd bin <== same as above because i im in my home dir

cp /etc/passwd /tmp

cp ../../etc/passwd .

cp /etc/passwd $HOME

cp /etc/*.conf $HOME

cp -i /etc/passwd /tmp


cp -r bin binbac

cp -r ./bin ~/binback

cp -r ./bin ~arununix

cp ~oracle/*.sh ~/bin

Theory : What is a shell script & how to execute it

Command : file 

Command : set <== display values of user & system defined variables

Command : env <== display values of system defined variables

Command : stat

Command : wc 

wc -l <== display total number of lines in a file

wc -w <== display total number of words in a file

wc -c <== display total number of characters in a file

Command : mv  <== rename a file or to move a file ( cut paste)

mv a.txt b.txt

mv /home/shekahr/a.txt /home/aaftab/b.txt

mv $HOME/a.txt b.txt

mv ~/a.txt ~aaftab/b.txt

mv ./a.txt ./b.txt

mv a.txt /tmp

mv a.txt /tmp/b.txt

mv ~arununix/.bash_profile ~

mv ~oracle/*.sh ~/bin


mv /home/aaftab/bin /home/shekahr/binbak

mv /home/aaftab/bin/* /home/shekahr


Command : rm 

rm a.txt

rm -i a.txt

rm -f a.txt

rm *.sh

rm $HOME/*.txt

rm ~oracle/*.sh

rm /tmp/*.tmp

rm -r ./bin <==  remove bin directory

rm -r $HOME/bin <==remove bin directory

rm -r /home/aaftab/bin <==  remove bin directory


rm -f /tmp/a.txt

rm -i /tmp/a.txt


Command : mkdir 

mkdir /home/aaftab/newbin

mkdir ~/newbin

mkdir newbin

mkdir ./newbin

mkdir ~oracle/newbin

mkdir $HOME/newbin

mkdir /tmp/aaftab

Command : rmdir 

rmdir /home/aaftab/bin <== remove dir if it is empty

Symbol : ~

Symbol : .

Symbol : ..

Theory : Client Server Concepts

Servers: sshd(22), vsftpd (21), httpd(80) dns(53)

Daemon is a constantly running program in the background

Note:  File related commands (ls, cat, more, less, wc , cp, mv, touch,  

Note:  Dir related commands (ls, 




Day No. 3

---------

Command : man

man -k keyword

SEE ALSO

Command : whatis

whatis ls 

Command : whereis

whereis cp 

Command : which

which cp

Command : tar 

tar -c -f /tmp/aaftab.tar /home/shekahr

tar -x -f /tmp/aaftab.tar -C /tmp/new

tar -t -f /tmp/aaftab.tar

tar -c -z -f /tmp/aaftab.tar.gz /home/shekahr

tar -x -f /tmp/aaftab.tar.gz -C /tmp/aaftab

tar -c -f /tmp/aaftab_26_06_2014.tar $HOME

tar -c -f /tmp/aaftab_26_06_2014.tar ~

Command : gzip 

gzip abcd.txt

gzip /tmp/abcd.tar

Command : gunzip 

gunzip abcd.txt.gz

gunzip abcd.tar.gz

gunzip /tmp/abcd.tar.gz


Command : zip 

zip abcd.txt.zip abcd.txt

Command : unzip

unzip abcd.txt.zip

Command : vi


3 modes - command (Esc) , typing mode (insert) , Ex Mode

Type - insert  (below current line  - o , above current line)

i - insert  before current position

a - insert after the current position

o - below the current line

O - above the current line

delete (word, line, multiple lines, char)

dw - delete a word

dd - delete the current line

9dd - delete 9 lines below the current, including the current line

D - delete from the current position till the end of line

x - delete a current character

copy (word, line, ...)

yw - copy current word

yy - copy current line

9yy - copy 9 lines including the current line

paste (above the current line, below current line, at the end of the line)

p - paste clipboard below current line

P - paste clipboard above current line

undo

u - undo previous changes

search (above the current cursor location, below the current cursor location)

/aaftab  <== search the word aaftab below current position

?aaftab  <== search the word aaftab above current position

n - to goto next occurence of the searched word

replace  

:1,20s/aaftab/peter/ <== replace aaftab by peter from line 1 till 20

  replace only the first occurence of word aaftab 

:1,40s/aaftab/peter/g <== replace aaftab by peter from line 1 till 40

  replace all occurences of word aaftab in these lines

:1,$s/aaftab/peter/g <== replace aaftab by peter in the entire file

  replace all occurences of word aaftab in entire file

:%s/aaftab/peter/g <== replace aaftab by peter in the entire file

  replace all occurences of word aaftab in entire file


r <== replace a current character

cw <== change the current word

redo

. <== redo the previous command

save

:w <== save

:w! <== save even if the file is read only

(you must be the owner of the file)

close/exit/quit - quit without saving

:q <== quit

:q! <== quit without saving

show line numbers

:set nu

:set nonu

goto - begining of file , end of file, to spacific line, 

start of line, end of line

up , dkkkkwn , right, left

gg <== gkkkk to the begining of the file

G <== end kkkkf the file

:5 <== gkkkk to line number 5

^ <== go to start of the current line

$ <== go to the end of the current line

j <== down arrow

k <== up arrow

l <== right arrow

h <== left arrow

page up

ctrl b < ==pageup

page down

ctrl f <== pagedown

bring contents from other file  to the current file

:r a.txt <== bring contents of a.txt into current file at the current cursor location




Day No. 4

---------

Command : sort

cat data.txt

aaftab Pune 99

Sachin Parbhani 9000

Sanyam Satara 888


sort data.txt

sort /home/aaftab/UNIX/data.txt

sort -r /home/aaftab/UNIX/data.txt

sort -k2 /home/student/Desktop/data.txt

sort -r -k2 /home/student/Desktop/data.txt

sort -k2 -r /home/student/Desktop/data.txt

sort -rk2  /home/student/Desktop/data.txt

sort -k3  /home/student/Desktop/data.txt

sort -k3   -n /home/student/Desktop/data.txt

sort -r -n -k3  /home/student/Desktop/data.txt

sort -rnk3  /home/student/Desktop/data.txt

aaftab:Pune:99

Sanyam:Satara:888

Sachin:Parbhani:9000

sort -n -t: -k3 data.txt 

sort -n -t':' -k3 data.txt 

Command : uniq

uniq data.txt

Command : cut

cut -d":" -f1 data.txt

cut -d":" -f2 data.txt

cut -d":" -f1,3 data.txt

cut -d":" -f1-3 data.txt

cut -d'a' -f2 data.txt

cut -d' ' -f3 data.txt 

cut -d' ' -f3 /home/student/data.txt 

File : /etc/passwd

stores user info on your system

1. username

2. password (always x)

3. UID

4. GID

5. Name or info of user

6. home directory of the user

7. login shell <= shell program automatically starts when user logs in 

cut -d':' -f1 /etc/passwd

cut -d':' -f1,6 /etc/passwd

Command : fgrep , grep, egrep

grep aaftab data.txt

grep -i aaftab data.txt

grep -v aaftab data.txt

What is a regular expression :

It is a search pattern used by commands like grep, egrep, sed, etc to search a specific pattern of characters in a file

Regular expressions

. <== any single char

* <== zero or multiple occurances of a previous char

^aaftab <== aaftab word is at the begining of the line

aaftab$ <== aaftab is at the end of the line

[abc] <== either a or b or c

[^p] <== any char other than p

[a-z] <== any char from a to z

[A-Z] <== any char from A to Z

^$ <== blank line

[0-9] <== any single digit

[086] <= either 0 or 8 or 6

[^086] <= neither 0 nor 8 nor 6

Extended Regular expression

egrep '(aaftab|peter)' data.txt <== show all line those contain either aaftab or peter


grep -E '(aaftab|peter)' data.txt <== show all line those contain either she    khar or peter



Command : diff 

Command : tr

echo 'aaftab      Tulshibagwale | tr -s ' '

Command : cmp 

io redirection:   cmd 1> filename 

io redirection:   cmd 1>>  filename

  1> filename <== created a blank file

What is a /dev/null file

There is a file named null in /dev/ directory. Anyone has the write permission on this file. Any data written or redirected to this file is immediately erased. This file, therefore, can be used for collecting garbage.

io redirection: cmd | cmd

cut -d':' -f1 /etc/passwd | sort

ls -l | sort -n -k5 | tail -1

ls -l /etc | sort -n -k5 | tail -1

who | cut -d' ' -f1 | sort | uniq

io redirection: &> 

io redirection: 2>> 

io redirection: 2> 

tar -cvf /tmp/a.tar /etc 1> a.txt

tar -cvf /tmp/a.tar /etc 2> b.txt

tar -cvf /tmp/a.tar /etc &> c.txt


Command that need input

cat, wc, sort, more, less, grep, fgrep, egrep, head, tail, sed  


io redirection: < 

Note: stdout is a virtual file sttting in RAM. You cannot see this file using

ls command. The file descriptor for this file is 1. 


Day No. 5

---------

Ad Practicals : No 1

Ad Practicals : No 2

Ad Practicals : No 3



Day No. 6

---------

Theory : permissions, groups, users

Command : id 

id <= displays uid and gid of currently logged in user

id oracle <==displays uid and gid of user oracle

Command : groups 

groups <== displays all groups that you are a member o (first group is the primary group)

groups oracle <== displays all groups that the user oracle is a member of

FIle : ~/.bash_logout

FIle : ~/.bash_profile

FIle : ~/.bash_history

FIle : ~/.bashrc 

FIle : ~/.vimrc 

File : /etc/group <== list of all groups

Command : chgrp 

chgrp dba a.txt <== changes the group owner of a.txt file to dba

Command : chmod 

Only owner/root can run the chmod command on a file/directory

u=owner/user   g=group   o=other  a=all

-  <== remove the permission

+ <== give the permission

chmod g+x $HOME

chmod go-rwx $HOME

chmod a+rwx $HOME <= be careful when you run this command

chmod a-rwx a.txt

chmod u+rwx,g+rx a.txt


r - 4

w - 2

x - 1


chmod 444 a.txt 

chmod 421 a.txt 

chmod 621 a.txt 

chmod 700 a.txt 

chmod 750 a.txt 

chmod 755 a.txt 

chmod 777 a.txt 

chmod -R 755 $HOME

chown

chown arung a.txt <== chown can be executed by root only

changes the owner of a.txt file to arung

chown arun.dba a.txt <== changes owner to arun and group owner to dba

chown arun:dba a.txt <== changes owner to arun and group owner to dba

chown -R arun:dba /home/aaftab <== changes owner to arun and group owner to dba of all file and subdirectories inside /home/aaftab


Shortcuts : ctrl + d 





Day No. 7

---------

Command : ps

ps

ps -e <== shows everything i.e. all processes on your system

ps -f  <== full listing i.e. give more info of process

ps -ef

ps aux <== give cpu and ram info of each process


IMP fields (owner, pid, ppid, comm, %CPU, %MEM)

Command : pstree <== shows parent child relationships between processes

Command : top 

Command : free 

Swap mean virtual ram. It is not real  ram. It is some space on hard disk

Swap = page file in windows

Swap can be a file on a hard disk or it can be a partition on the harddisk

File : /proc/meminfo

Command : mpstat

File : /proc/cpuinfo

Command : iostat

Command : bg

Command : fg <== bring the background job to foreground. The background job

may be running or stopped.

Status : 

Running & attched to terminal - Running in the foreground

Running in background

Stopped

Command : jobs <== display list of jobs started from the termonal

Command : sleep

Command : kill

kill 8188 <== kill i.e. terminate the process with 8188 PID

kill -9 8188 <== forceful/sure kill if the process cannot be killed by the above command

Command : lsof <== display list of opened files

lsof

lsof -u aaftab <== all files opened by aaftab (can be run by root)

lsof -p 1881 <== shows all files opened by process 1881

Symbol : &

Shortcuts : ctrl + c 

Shortcuts : ctrl + z 





Day No. 8

---------

Command : nslookup

Command : nmap

Command : netstat

Command : bc

Command : dnsdomainname

Command : scp

Command : ftp

Command : lftp

Command : sftp

Command : wget

Command : rsync





Day No. 9

---------


Command : crontab

Note: crontab is a command which interacts with a daemon named crond.

Daemon is a constantly running process in the background. The daemon process

is not attached to the termminal. i.e. TTY is ?. This crond daemon is

automatically started when your server is booted. You can check if this

process is running or not by typing the following command

ps -ef | grep crond 

service crond status


The purpose of this daemon process is to wake up every minute and

check if there are any programs/scripts that need to be executed on behalf of

some user. A program/script scheduled to run at a specific time is called as a

job. In other words crond is reponsible for running jobs on your system. 


The crontab command is the way to tell crond about which

program/script to run at which time and at which interval.


crontab -l <== see the existing job schedule

crontab -r <== remove the existing job schedule (dengerous command)

crontab -l > crontab.backup    <== output of crontab -l is stored in crontab.backup file

crontab < crontab.newfile  <== Schedule eritten in crontab.newfile is sent as an input to the crontab command


Explain each and every entry in crontab file.

       The time and date fields are:


              field          allowed values

              -----          --------------

              minute         0-59

              hour           0-23

              day of month   1-31

              month          1-12 (or names, see below)

              day of week    0-7 (0 or 7 is Sun, or use names)


       A field may be an asterisk (*), which always stands for "first-last".


       Ranges  of  numbers are allowed.  Ranges are two numbers separated with a hyphen.  The speci-

       fied range is inclusive.  For example, 8-11 for an "hours" entry specifies execution at hours

       8, 9, 10 and 11.


       Lists  are  allowed.   A list is a set of numbers (or ranges) separated by commas.  Examples:

       "1,2,5,9", "0-4,8-12".


       Step values can be used in conjunction with ranges.  Following a range with "<number>" speci-

       fies skips of the number’s value through the range.  For example, "0-23/2" can be used in the

       hours field to specify command execution every other hour (the alternative in the V7 standard

       is  "0,2,4,6,8,10,12,14,16,18,20,22").  Steps are also permitted after an asterisk, so if you

       want to say "every two hours", just use "*/2".



Command : find

find command is used to find a file/s in a specific directory (Note: grep is used to find a word/string in a file/s)

find - search for files in a directory hierarchy


Syntax :

     find   which_dir   [criteria]       action 

            ---------   -----------      -------  

A file whose name is a.txt and print it on the terminal

     find   /home       -name a.txt      -print


A file whose name is a.txt, A.txt, A.TXT and print it on the terminal

     find   /home       -iname a.txt      -print



A file whose owner is aaftab and print it on the terminal

     find   /home       -user aaftab   -print



Find in either /home or /etc a file whose owner is aaftab and print it on the terminal

     find   /home /etc  -user aaftab   -print


Find in /home a file whose groupowner is oinstall and list the file details like the ls command

     find   /home       -group oinstall -ls


Find in /home a files whose permission is 777 and list the file details like the ls command

find   /home -perm 777 -ls 2> /dev/null


             +10                          10          -10

<-----------------------------------------|---------------------|

                                          5                     15

                                                              (Today)

Find files in /home whose modification time is exactly 7 days ago

     find   /home       -mtime  7 -print


Find files in /home whose modification time is  before 7 days 

     find   /home       -mtime  +7 -print


Find all log files in /tmp whose modification time is  before 7 days and delete them

     find   /tmp        -mtime  +7  -name '*.log'  -delete


Find files in /home whose modification time is within last  7 days 

     find   /home       -mtime  -7 -print



     find   /home       -atime  <== access time


Find files in /home whose size is 10M   (you can use K M G T)

     find   /home       -size 10M -print

 

Find files in /home whose size is greater than 10M 

     find   /home       -size +10M -print

    find  / -user oracle -size +100M -ls 2> /dev/null


Find files in /home whose size less is 10M 

     find   /home       -size -10M -printo



     find   /home       -newer a.txt       -exec rm {} \;

     find   /home       -newer a.txt       -exec cp {} /tmp  \;

     find   /home       -newer a.txt       -exec mv {} /tmp  \;

     find   /home       -newer a.txt       -exec chmod 700  {} \;

     find   /home       -newer a.txt       -exec chown oracle.oinstall {} \;

     find   /home       -newer a.txt       -exec grep aaftab {} \;

     find   /home       -newer a.txt       -exec wc -l  {} \;

     find   /etc        -name '*.conf'     -exec cp {} /mybakup \;

     find   /etc        -name '*.conf'     -exec cp {} /mybakup/{}.bak \;


    tar -cvf /tmp/a.tar /home/aaftab/a.sh /home/aaftab/b.sh /home/aaftab/c.sh 

    tar -cvf /tmp/a.tar `find  /etc -name '*.conf' -print`


     find   /home       -empty 

     find   /home       -gid  100

     find   /home       -uid  200 



     find   /home       -newer a.txt       -print

     find   /home       -newer a.txt       -ls

     find   /home       -newer a.txt       -delete

     find   /home       -newer a.txt       -ok

     find   /home       -newer a.txt       -ok -exec rm {} \;


     find   /home       -inum 27772       -print



Some examples of find commands :


# touch  file_{1,2,3}


# touch  FILE_{1,2,3}


# touch  file_{pune,mumbai,nagpur}


1>  find /home/aaftab     -name  "file_pune    -print

         ------------      -----------------     ----------- 

where to find      What to find          What action to take on this file


2>  find .   -name  "file_?" 


3>  find $HOME  -name  "file_*"


4>  find /etc  -name  "*.conf"


5>  find /usr  -name  "*.gz"


7>  find /  -user  lp  -name a.txt  2>  /dev/null


8>  find /var -user root -group mail -print  2> /dev/null 


9>  find /var/lib -user rpm -group rpm -ls 2> /dev/null  | less


10> find /etc/httpd -exec file {} \;  


11> find /etc/mail -name "sendmail*" -exec file  {} \; 


12> find /etc -name "*.conf" -exec cp {} {}.bak \; 


13> find /etc -name *.conf.bak -ok rm {} \;  # -ok is like -exec, but asks user for confirmation


14> find /tmp  -type f  -ls  2> /dev/null  


15> find /tmp  -type d  -ls  2> /dev/null


17> find /etc  -type l  -ls  2> /dev/null  | wc -l


18> find /var/lib -user games -ls 2> /dev/null  | less


19> find  /bin  /usr/bin/  /sbin  -perm -u+s  -ls  2> /dev/null


20> find /etc/httpd/conf  -ok file {} \;


21> tar -cvf etc.tar $(find /etc -name  "*.conf" ) 


22> find /etc -name passwd  >  /tmp/output_of_find


23> find /etc -name squid.conf  >>  /tmp/output_of_find  2> /dev/null


24> find $HOME -mtime +7 -print


25> find $HOME -mtime -7 -print




Command : ln

Command : mail

mail <== check the email inbox (1, d 2, d * )

mail  aaftab@gmail.com (. means end of email)

mail -s 'Hello' aaftab@gmail.com < /etc/passwd 

mail -s 'Hello' aaftab@gmail.com -a b.txt < /dev/null








Day No. 10

---------

Command : rpm 

rpm -qa

rpm -qa | grep nmap

rpm -q

rpm -qi

Command : ssh-copy-id

Command : ssh-key-gen

Command : vmstat

Test : No 10

Q: Which command is used to find information about already installed software

rpm -q package_name  (e.g rpm -q nmap)

rpm -q software_name

Q: How to get the detailed info of the vsftpd software/package

rpm -qi vsftpd

Q: What version of httpd software has been installed on your system

rpm -q httpd

Q: How to find all packages installed on your system

rpm -qa   (a means all)

Q: Is perl or python installed on your system

rpm -qa | grep perl

rpm -qa | grep python

Q: What is the version of perl

rpm -qi perl

Q: have you installed 64 bit or 32 bit version of python

rpm -q python <== look for x64

Q: Which command creates publc and private keys

ssh-keygen

Q: In which dir these keys are stored

$HOME/.ssh 

Q: What are the permissions on the private key

rw-------

Q: WHich algorithm is used to encrypt these keys

RSA

Q: How to put your public key in some other user's account

ssh-copy-id  student@192.168.0.2

The above command will copy your public key in student's account 

on 192.168.0.2 machine. The password of student will be asked.

Q: Where is the public key stored in student's account 

~student/.ssh/authorized_keys

Q: How to execute a command on another machine

ssh student@192.168.0.2 'hostname'







Day No. 11

---------

Ad Practicals : No 1

Ad Practicals : No 2

Ad Practicals : No 3



Day No. 12

-----------

Final test (Theory + Practicals)