Friday, January 15, 2016

CentOS - Become System Administrator- Installation

What is CentOS ?

C - Community 
ENT - Enterprise
O - Operating 
S - System

  • CentOS Stand for Community ENTerprise Operating System.
  • RPM Based distribution, All the package management is done by RPM. A tool YUM is also used.
  • CentOS source code is based on Red Hat Linux.
  • No Specific Certification is available.

CentOS Release and Support 

 Major Releases
Major CentOS Version 2,3,4,5,6,and 7. Major 7 is current Version.

 

Minor/Point Releases

 There are Minor release usually twice a year, A point release is something like 7.1, 7.2 etc.

Point Release basically update kernel ,Software Packages,Security Update etc.

No Extended Support is provided by CentOS after expiration of Support period.

Installation

Configuration after installation

CentOS-Become System Administrator- Basic Bash Command- I/O Redirection

Basic  BASH Command

I/O Redirection

1. Input/Output Redirection in BASH( Again Shell) - Most command in Linux reads input and write output.By default input is given by Keyboard and output is given  to  terminal(monitor).

Every command has three file descriptor : STDIN, STDOUT, STDERR.
STDIN : 0    - Comes from keyboard
STDOUT  : 1 - goes to console
STDERR  : 2 - goes to console


Not all command listen for STDIN(standard Input) some of them only have argument. for example ls command , it is not waiting for input, it optionally work with argument




Redirection operator

it is possible to redirect STDIN, STDOUT, and STDERR to other places.

Input Redirection  with  0< or <  - for redirect STDIN

Redirection is done using 0< or <(less than symbol) operator. 0 is optional.

[yogesh@lap ~]$ read fromkb
hello i am reading from keyboard and save it fromkb variable, use echo $fromkb to view my content
[yogesh@lap ~]$ echo $fromkb
hello i am reading from keyboard and save it fromkb variable, use echo $fromkb to view my content
Now we use < or 0< for redirect STDIN, I create a message file message.txt using vi editor
$ vi message.txt
Previously we saw that read command read from KEYBOARD we use STDIN redirect , now it read from message.txt file and store it into variable fromfile, we can see the value of fromfile variable using echo command.
[yogesh@lap ~]$ cat message.txt
read command by default read from keyboard now < or 0< is used for redirect STDIN, now it read content form file and store it into variable tempfile
[yogesh@lap ~]$ read fromfile < message.txt
[yogesh@lap ~]$ echo $fromfile
read command by default read from keyboard now < or 0< is used for redirect STDIN, now it read content form file and store it into variable tempfile
[yogesh@lap ~]$

Output Redirection with 1> or > - for redirect STDOUT


> or 1> is used to redirect STDOUT, For example ls command list the content of directory at terminal but if we want to redirect it to a file the we use > or 1>.  In 1> ,No need to type 1 , it is presumed.

[yogesh@lap test]$ ls
file1,  file2  message.txt

[yogesh@lap test]$ ls > ls.out
[yogesh@lap test]$ cat ls.out
file1,
file2
ls.out
message.txt

/*****we can use 1>  produce same result******/

[yogesh@lap test]$ ls 1>ls.out
[yogesh@lap test]$ ls
file1,  file2  ls.out  message.txt
[yogesh@lap test]$ cat ls.out
file1,
file2
ls.out
message.txt
[yogesh@lap test]$ 

Output Redirection 2> - for redirect STDERR

By default all Error message  also shown at Terminal, it is possible to redirect error message to another place like a log file for latter analysis. Following Example show how ls command redirect Error message to file.

[yogesh@lap test]$ ls
file1  file2  ls.out  message.txt
[yogesh@lap test]$ ls file1 file3
ls: cannot access file3: No such file or directory
file1
[yogesh@lap test]$ ls file1 file3 2>errorlog.out
file1
[yogesh@lap test]$ cat errorlog.out 
ls: cannot access file3: No such file or directory


& - Ampersand is  an indication that the number that follows is not a file name, but rather a location that the data stream is pointed to.
[yogesh@lap test]$ ls
file1  file2  message.txt
[yogesh@lap test]$ ls 1>test.out 2>&1
[yogesh@lap test]$ ls
file1  file2  message.txt  test.out
[yogesh@lap test]$ cat test.out
file1
file2
message.txt
test.out
[yogesh@lap test]$ 


>> Operator - >> operator append text to a file instead of overwriting it.

[yogesh@lap test]$ ls
file1  file2  message.txt  test.out
[yogesh@lap test]$ echo hello test file1 > file1
[yogesh@lap test]$ cat file1
hello test file1
[yogesh@lap test]$ echo hello i am test file2 > file2
[yogesh@lap test]$ cat file2
hello i am test file2
[yogesh@lap test]$ echo i am write some content to file1 > file1
[yogesh@lap test]$ cat file1
i am write some content to file1
[yogesh@lap test]$ echo i am append some content to file2 using append operator >> file2
[yogesh@lap test]$ cat file2
hello i am test file2
i am append some content to file2 using append operator
[yogesh@lap test]$ 

By default | (pipe symbol above Enter Key US Keyboard) - Pipe the result of one command to other command. i.e. output of one command become input of another command. for example
[yogesh@lap test]$ cat itemlist
1
2
4
5
6
7
19
3
8
12
9
[yogesh@lap test]$ cat itemlist | sort -n
1
2
3
4
5
6
7
8
9
12
19
[yogesh@lap test]$ 

Writing to STDOUT and File simultaneously

tee command is used in this case, tee command send output to one or more file in one move.

tee - a is used to append.

for example.
[yogesh@lap test]$ date | tee f1 f2 f3
Fri Jan 15 14:21:17 IST 2016
[yogesh@lap test]$ cat f1
Fri Jan 15 14:21:17 IST 2016
[yogesh@lap test]$ cat f2
Fri Jan 15 14:21:17 IST 2016
[yogesh@lap test]$ cat f3
Fri Jan 15 14:21:17 IST 2016
[yogesh@lap test]$ cat teetest | tee -a f1 f2 f3
cat: teetest: No such file or directory
[yogesh@lap test]$ echo content added to f1 f2 and f3 | tee -a f1 f2 f3 
content added to f1 f2 and f3
[yogesh@lap test]$ cat f1 && cat f2 && cat f3
Fri Jan 15 14:21:17 IST 2016
content added to f1 f2 and f3
Fri Jan 15 14:21:17 IST 2016
content added to f1 f2 and f3
Fri Jan 15 14:21:17 IST 2016
content added to f1 f2 and f3
[yogesh@lap test]$ cat f1 f2 f3
Fri Jan 15 14:21:17 IST 2016
content added to f1 f2 and f3
Fri Jan 15 14:21:17 IST 2016
content added to f1 f2 and f3
Fri Jan 15 14:21:17 IST 2016
content added to f1 f2 and f3

Saturday, January 9, 2016

Google Cloud Platform(GCP)-Google Cloud SQL

What is Google Cloud SQL

It is part of Google Cloud Platform(GCP), GCP have lot of software for different type of problem

Google Cloud Platform

CentOS 7- Monitoring and Controlling Laptop Heat / Temperature

I was facing Laptop Heating problem from first day when I have decided to switch CentOS Linux Operating System. I will  help you figure out what’s causing the heat and how to keep your laptop functioning at a lower temperature in Linux.

 

Problem Introduction:

We all know when process  execute at a higher clock speeds, CPU consume more power,resulted CPU temperature increased, for stability of our laptop it's fan running fast for reducing increased temperature.
So laptop heat problem is related to Hardware as well as Software

 

Wednesday, January 6, 2016

Single Row Function - NULL Related Function

NULL has special meaning , we can't compare null with other null value.
Can't use NULL value in any calculation,but sometimes we need null valued column in our calculation.

For this we have some special function that change null value with some other value.
  1. NVL Function
  2. NVL2 Function
  3. COALESCE Function
  4. NULLIF Function
  5. LNNVL Function
  6. NANVL Function

1. Oracle SQL/PLSQL : NVL Function

Syntax :  NVL(column|expr|null,default_value)
Purpose:    
 NVL Function  is used to replace null with some default value.
Example:


 

 

Single Row Function - Conversion Function


Single Row Function - General Comparision Function


Single Row Function - DATE TIME Function


Monday, January 4, 2016

Single Row Function-Numeric Function

All Numeric Function accept numeric value and return numeric value.

Some Important Numeric Function are 
1. ABS function
2. POWER function
3. SQRT function
4. SIGN function
5. ROUND function
6. TRUNC function
7. FLOOR function

Sunday, January 3, 2016

Single Row Function-Character Function

Accept one or more argument that can be column name ,expression,Variable value or User Supplied Constant and return one value for each row.

Can be used in SELECT, WHERE and ORDER BY clause and can be nested.

Type of Single Row function

  1. Character  function