SlideShare uma empresa Scribd logo
1 de 161
Baixar para ler offline
UNIX Basics www.scmGalaxy.com Author: Rajesh Kumar www.scmGalaxy.com,  Author - Rajesh Kumar
Contents 1.Introduction to Unix     03 - 11  2. Logging In and Basic Commands     12 - 26 3File system    27 - 45  4.managing files   46 - 55 5.File Access Permissions   56 - 68 6.vi Editor    69 -  78 7.Shell Basics    79 – 94 8. Standard I/O Redirection  95 – 103 9. Filters & some utilities     104 – 123 10. Controlling Processes   124 – 132 11. Shell Programming concepts   133 - 158 12. Labs 159 - 161 www.scmGalaxy.com,  Author - Rajesh Kumar
Introduction to Unix Module 1 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
What Is an Operating System?  ,[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],History of the UNIX Operating System www.scmGalaxy.com,  Author - Rajesh Kumar
UNIX Architecture – Kernel & Shell Shell Kernel Hardware User www.scmGalaxy.com,  Author - Rajesh Kumar
UNIX Architecture – System Calls ,[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],More Features of UNIX www.scmGalaxy.com,  Author - Rajesh Kumar
Flavors of UNIX ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Clone of UNIX (LINUX) ,[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Logging In and Basic Commands Module 2 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],A Typical Terminal Session www.scmGalaxy.com,  Author - Rajesh Kumar
Logging In and Out telnet 192.168.10.1 User: Password: exit or <ctrl>+<d> will terminate the login session www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Command Line Format www.scmGalaxy.com,  Author - Rajesh Kumar
$ echo 'hi >Good Morning‘ > is the default secondary prompt The Secondary Prompt www.scmGalaxy.com,  Author - Rajesh Kumar
Content of the Manual Pages NAME WARNINGS SYNOPSIS  EXAMPLES DESCRIPTION  AUTHOR RETURN VALUE FILES ERRORS SEE ALSO BUGS   etc. www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: man –[k|X]   keyword in which  X  is the number of one of the manual sections Examples: $ man ls  Display the “ls&quot; man page.  $ man -k cat  Display entries with keyword &quot;cat&quot;.   $ man passwd  Display the &quot;passwd&quot; man page-Section 1.   $ man 4 passwd  Display the &quot;passwd&quot; man page-Section 4.   The Online Manual www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: id   Displays effective user and group identification for session Example: $id uid =303 (user3) gid=300 (class) The id Command www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax : who     Reports information about users who are   currently logged on to a system Examples: $   who  root  tty1p5  Jul 01 08:01 user11  tty1p4  Jul 01 09:59 user12  tty0p3  Jul 01 10:01 $ who am i user12  tty0p3  Jul 01 10:01 $ whoami user12 The who Command www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: date  Reports the date and time Example: $ date  Fri Jul  1 11:15:55 EDT 2005 The date Command www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: cal  Reports the calendar of 2005 September(Current  month) Example: $  cal 8 2005  for Aug 2005 $  cal 2005  for the full calendar of year 2005 The cal Command www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: passwd  Assigns a login password Example: $ passwd   Changing password for user1   Old password:   New password:   Re-enter new password: The passwd Command www.scmGalaxy.com,  Author - Rajesh Kumar
The clear Command Syntax: clear Clears terminal screen www.scmGalaxy.com,  Author - Rajesh Kumar
finger Finger: Displays information about the users currently logged on Eg: $ finger user1 Login name: user1 Directory: /export/home/user1 shell:/usr/bin/sh On since Sep 05 09:10:12 on tty1 No plan www.scmGalaxy.com,  Author - Rajesh Kumar
File System Module 3 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
What Is a File System? collection of control structures and Data blocks that occupy the space defined by a partition and allow for the storage and management of data. Data + Meta data www.scmGalaxy.com,  Author - Rajesh Kumar
a File System structure www.scmGalaxy.com,  Author - Rajesh Kumar Primary Superblock Backup Superblock Cylinder Group Block Inode Table Data Blocks
Hard Link Allows a file to have more than one name and yet maintain a single copy on the disk. All the links have the same inode number Eg: $ ls  –i  f1 1113 f1 $ ln  f1  f1.lnk $ ls –i  f1.lnk 1113   f1.lnk  www.scmGalaxy.com,  Author - Rajesh Kumar
a File Types Common File Types: Ordinary files:  regular files  Directory files:  table of contents, that stores a list of files/directories within that directory Device files:  For every device there is a device file used by kernel to interact with the device. Symbolic Link:  Its link to other files www.scmGalaxy.com,  Author - Rajesh Kumar
a Ordinary Files A regular file simply holds data.  Regular files can hold  ASCII text, binary data, image data, databases, application-related data, and more. www.scmGalaxy.com,  Author - Rajesh Kumar
a Directory Files Directory Inode Table name inum  #  type  mode  links  user  group  date  size  loc d1  4   4  dir  755  2  user1  group1  Sep 5  9:30  512 f1  10  10  file  644  1  user1  group1  Sep 5  9:45  12  www.scmGalaxy.com,  Author - Rajesh Kumar
a Symbolic Links contains the path of the file to which it links Exists even after the source file is removed and is exactly similar to Windows shortcut Syntax: ln –s soucefile linkfile Eg: ln  -s  /f1  f1.lnk Overcomes 2 limitations of Hard Link: 1. possible across filesystems 2. can link to a directory www.scmGalaxy.com,  Author - Rajesh Kumar
a Device files A device file provides access to a device. # cd /devices/pci@1f,0/pci@1,1/ide@3 # ls -l brw------- 1 root sys 136, 0 Apr 3 11:11 dad@0,0:a Two types of device files: block device files character device file www.scmGalaxy.com,  Author - Rajesh Kumar
The File System Hierarchy / usr etc devices dev var tmp bin sbin ls who adm sadm dsk rdsk www.scmGalaxy.com,  Author - Rajesh Kumar
a system directories / :root directory, top level directory  /bin : user commands like cp, cron, cmp etc.. /usr/sbin: admin commands /dev : logical device files of all hardware devices /devices: physical device files /etc : System configuration files and user database /tmp : to store temporary files /usr : the binaries, shared libraries, shared documentation etc. /var: stores the log files and dynamic files  www.scmGalaxy.com,  Author - Rajesh Kumar
a File Path name A sequence of file names, separated by slashes (/), that  describes the path, the system must follow to locate a  file in the file system Absolute pathname (start from the /-directory): Eg: /export/home/user1/file1 Relative pathname  (start from the current directory) ./test1 (. = current directory) ../team03/.profile (.. = parent directory) www.scmGalaxy.com,  Author - Rajesh Kumar
pwd - Present Working Directory pwd prints the Current Directory www.scmGalaxy.com,  Author - Rajesh Kumar
6 Syntax: ls [-adlFR] [ pathname(s)] Example: $ ls f1 f2 memo $ ls -F f1 f2* memo/ $ ls -aF profile f1 f2* memo/ $ ls memo f1 f2 ls - List Contents of a Directory www.scmGalaxy.com,  Author - Rajesh Kumar
cd  Change Directory Example: $ pwd /home/user3 $ cd memo; pwd / home/user3/memo $ cd ../..; pwd /home $ cd /tmp; pwd /tmp syntax: cd [dir_name] www.scmGalaxy.com,  Author - Rajesh Kumar
mkdir, rmdir – create & remove Directories Syntax:  mkdir directory eg:  $ mkdir d1 syntax: rmdir  dir eg: $ rmdir /export/home/user1  www.scmGalaxy.com,  Author - Rajesh Kumar
working with Multiple Directories Create multiple directories simultaneously: $ mkdir -p dir1/dir2/dir3 Remove a directory and all its subdirectories $ rmdir -p dir1/dir2/dir3 www.scmGalaxy.com,  Author - Rajesh Kumar
The touch Command Updates the atime and mtime of a file if it exists.  Else create an empty file Example: $ ls –l -rw-r—r--  1  user1  group1  100  Sep 5 09:30 test $date Mon, Sep 5 10:00 2005 $ touch  test  file1 $ ls  -l -rw-r—r--  1  user1  group1  100  Sep 5 10:00  test -rw-r—r--  1  user1  group1  100  Sep 5 10:00  file1 www.scmGalaxy.com,  Author - Rajesh Kumar
Managing Files Module 4 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
File Characteristics File Type Permissions Links Owner Group Size Timestamp Name $ ls -l  -rw-r--r--  1  user3  class  37  Jul 24 11:06  f1 -rwxr-xr-x  1  user3  class  52  Jul 24 11:08  f2 drwxr-xr-x  2  user3  class  1024  Jul 24 12:03  memo www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: cat [ file...] Concatenate and display the contents of file(s) Examples: $ cat remind Your mother's birthday is November 29. $ cat note remind  The meeting is scheduled for July 29. Your mother's birthday is November 29. $ cat abc   abc 1234 1234 cat - Display the Contents of a File www.scmGalaxy.com,  Author - Rajesh Kumar CTRL + D
Syntax: more [ filename]... Display files one screen at a time Example: $ more funfile    .    .    .  --funfile (20%)--  Q  or q  Quit more Return  One more line   Space bar  One more page more - Display the Contents of a File www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: tail [- n]  [filename]...   Display the end of file(s) Example: $ tail -1 test soon as it is available. tail - Display the End of a File www.scmGalaxy.com,  Author - Rajesh Kumar
wc command The  wc  command counts the number of lines, words and bytes in a named file: syntax: wc  [-c]  [-l]  [-w]  filename Options: -c  counts the number of bytes -l  counts lines -w counts words Example: $wc  testfile 10 98 1000  testfile www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: cp [-i]  file1 new_file   Copy a file cp [-i]  file [file...] dest_dir   Copy files to a directory cp -r [-i]  dir [dir...] dest_dir   Copy directories Example: cp file1 d1  copies file1 to d1 directory cp file2 file3  create a copy of file2 as file3 in the same directory cp - Copy Files www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: mv [-i]  file new_file   Rename a file mv [-i]  file [file...] dest_dir Move files to a directory mv [-i]  dir [dir...] dest_dir   Rename or move directories Example:  $ ls -F  $ mv note remind memo f1  f2* memo/ note remind  $ ls -F $ mv f1 file1  file1  memo/ $ ls -F  $ls -F memo file1  f2* memo/ note remind  file2* note remind $ mv f2 memo/file2  $ mv memo letters $ ls -F  $ ls -F  file1 memo/ note remind  file1  letters/ $ ls -F memo  file2* mv - Move or Rename Files www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: rm [-if]  filename [filename...]   Remove files rm -r[if]  dirname [filename...]   Remove directories Examples: rm f1 removes the file f1 rm –r d1 remove the directory. rm - Remove Files www.scmGalaxy.com,  Author - Rajesh Kumar
File Access Permissions Module 5 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
File Permissions and Access Access to files is dependent on a user's identification and the permissions associated with a file. This module will show how to Understand the read, write, and execute access to a file Permissions  ls (11, ls -l) chmod umask chown chgrp su Determine what access is granted on a file Change the file access  Change default file access  Change the owner of a file  Change the group of a file  Switch your user identifier  www.scmGalaxy.com,  Author - Rajesh Kumar
Who can access a File? ,[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
contents can be  examined.  contents can be examined.  contents can be changed.  contents can be changed.  file can be used as a command. can become current working directory. Types of Access ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Change Permissions (Symbolic Notation)  Syntax:   chmod  mode_list file...  Change permissions of file(s) mode_list  [who[operator]permission] [ ,... ] who  user, group, other or all(u/g/a) operator  + (add), - (subtract), = (set equal to) permission  read, write, execute Example: Original permissions: mode  user  group  other rw-r--r-- rw-  r--  r-- $ chmod u+x,g+x,o+x file  or $ chmod +x file Final permissions: mode  user  group  other rwxr-xr-x  rwx  r-x  r-x www.scmGalaxy.com,  Author - Rajesh Kumar
Change Permissions(Octal Notation)  File and directory permissions can also be specified as an octal number: Read Permission :4 Write Permission :2 Execute Permission:1 We can just add the numbers to specify the permission for each category Example: 6 means read and write, 7 means read, write and execute eg: $ chmod  664 f1  will give read and write permissions for owner and  group  while only read for others www.scmGalaxy.com,  Author - Rajesh Kumar
Default Permissions The default protections for newly created files and directories are: File -rw-r—r-- 644 Directory drwxr-xr-x 755 These default settings may be modified by changing the  umask   value. www.scmGalaxy.com,  Author - Rajesh Kumar
umask - Permission Mask Umask specifies what permission bits will be set on a new file or directory when created. New Directory:  777 – 022 755   rwxr-xr-x New File : 666 – 022 644  rw-r—r— The default value of umask is set in  /etc/profile. This can be changed for all the users or a particular user www.scmGalaxy.com,  Author - Rajesh Kumar
chown - Change File Ownership Syntax:  chown  owner [:group] filename ... Example: $ id uid=101 (user1),  gid=101 (group1) $ cp f1 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----- 1 user1 group1 3967 Jan 24 13:13 f1 $ chown user2 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----- 1 user2 class 3967 Jan 24 13:13 f1 Only the owner of a file (or root) can change the ownership of the file. Changes owner of a file(s) and, optionally, the group ID www.scmGalaxy.com,  Author - Rajesh Kumar
The chgrp Command Syntax: chgrp  newgroup filename ...  Example: $ id uid=303 (user3),  gid=300 (class) $ ls -l f3 -rw-r----- 1 user3 class 3967 Jan 24 13:13 f3 $ chgrp class2 f3 $ ls -l f3 -rw-r----- 1 user3 class2 3967 Jan 24 13:13 f3 $ chown user2 f3 $ ls -l f3 -rw-r----- 1 user2 class2 3967 Jan 24 13:13 f3 www.scmGalaxy.com,  Author - Rajesh Kumar
su - Switch User Id Syntax: su [ user_name] Example: $ ls -l  f1 -rwxr-x--- 1 user1  group1 3967 Jan 24 23:13 class_setup $ id uid=303 (user1), gid=300 (group1) $ su – user2 Password: $ id uid=400 (user2), gid=300 (group1) Change your effective user ID and group ID www.scmGalaxy.com,  Author - Rajesh Kumar
Special File Permissions – setuid, setgid, sticky bit ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
vi  Editor Module 6 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],What Is vi? www.scmGalaxy.com,  Author - Rajesh Kumar
Starting and Ending a vi Session vi  [filename]  Start a vi edit session of file  Example: $ vi testfile - If the file doesn’t exist, it will be created  - Otherwise vi will open the existing file All modifications are made to the copy of the file brought into memory.  :wq  or :x  or <shift-zz>  write and quit :w write :q quit :q! Quit without saving www.scmGalaxy.com,  Author - Rajesh Kumar
Cursor Control Commands $ w,W l <right-arrow> <down-arrow> j L <ctrl-f> G 1G <ctrl-b> H k <up-arrow> 0 b,B h <left-arrow> www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],i   will insert character at the present cursor position I  will insert character at the beginning of the line a  will append character at the present cursor position  A will append character at the end of the line o  will insert a blank line below O will insert a blank line above www.scmGalaxy.com,  Author - Rajesh Kumar
Deleting Text: x, dw, dd, dG x   deletes the current character dw  deletes the current word dd   deletes the current line dG delete all lines to end of file, including current line. With any of these you can prefix a number  Example: 3dd will delete 3 lines d$   to delete to the end of the line d0 to delete to the start of the line www.scmGalaxy.com,  Author - Rajesh Kumar
Copying, moving and changing Text  yy copy the line yw copy the word   p will paste the yanked lines below dw cut the word  P will paste the yanked lines above     dd cut the line r  will overwrite the current character R will replace all text on the right of the cursor position cw will replace only the current word www.scmGalaxy.com,  Author - Rajesh Kumar
Searching for Text: /, n, N /director  will locate for the first occurrence of the pattern ‘director’ n  to locate the next occurrence N to locate the previous occurence www.scmGalaxy.com,  Author - Rajesh Kumar
Find and Replace  To find and replace the word  director  with  member : : 1,$s/director/member/g 1,$ represents all lines in the file g makes it truly global. g will ensure that all occuences in each line is replaced. Without g only the first occurrence of each line will be replaced. www.scmGalaxy.com,  Author - Rajesh Kumar
Shell Features Module 7 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Shell functionalities ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
/bin/bash /bin/ksh /bin/sh /bin/csh /bin/rksh /bin/rsh /bin/tcsh /bin/zsh Bash shell Korn shell Bourne shell C Shell Restricted Korn shell Restricted Bourne shell An amended version of the C shell The Z shell Commonly Used Shells www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],BASH Shell Features www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: alias [ name[=string]] Examples: $ alias dir=ls $ alias mroe=more $ alias mstat=/home/tricia/projects/micron/status  $ alias laser=&quot;lp -dlaser&quot; $ laser fileX request id is laser-234 (1 file) $ alias  displays aliases currently defined $ alias mroe  displays value of alias mroe mroe=more Aliasing www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Command History  www.scmGalaxy.com,  Author - Rajesh Kumar
Example: $ history 3 5  list command numbers 3 through 5 3 date  4 pwd  5 ls  $ r 4  run command number 4 pwd /home/kelley Re-entering Commands ,[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: env Example: $ env HOME=/home/gerry PWD=/home/gerry/develop/basics ... PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin:/home/gerry/bin The User Environment ,[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Two Important Variables www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],Setting Shell Variables . . . Syntax: name=value Example: color=blue  PATH=$PATH:/usr/ucb www.scmGalaxy.com,  Author - Rajesh Kumar
$ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin $ PATH=$PATH:$HOME:. $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin:/home/user3:. $ echo $HOME /home/user3 $ file_name=$HOME/file1 $ more $file_name <contents of /home/user3/file1> Variable Substitution www.scmGalaxy.com,  Author - Rajesh Kumar
Syntax: $( command) Example: $ dt=date  This will store the string date in the  variable dt not the  value $ dt=$(date) This will do command substitution and  store the result  of  date command in the  variable dt note:  instead of $(date) we can also use `date` Command Substitution www.scmGalaxy.com,  Author - Rajesh Kumar
[object Object],$ echo $HOME /home/user3 $ env HOME=/home/user3 … . SHELL=/usr/bin/sh $ set HOME=/home/user3 PATH=/usr/bin:/usr/contrib/bin:/usr/local/bin … . color=lavender count=3 dir_name=/home/user3/tree $ unset dir_name Displaying Variable Values www.scmGalaxy.com,  Author - Rajesh Kumar
Transferring Local Variables  to the Environment Syntax: export  variable Transfer  variable  to environment www.scmGalaxy.com,  Author - Rajesh Kumar
  Functions of a Shell before  Command execution. ,[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Standard I/O Redirection Module 8 www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
The Standard Files Standard Input File (0)  Keyboard Standard Output File (1) Monitor Standard Error File (2) Monitor operators: standard input redirection  0<  or  < standard output redirection 1>  or  > standard Error redirection 2> www.scmGalaxy.com,  Author - Rajesh Kumar
Input Redirection Default standard input $ mail user1 subject: Hi  Test mail <ctrl-d> Redirect Input from a file: < $ mail user1 < letter www.scmGalaxy.com,  Author - Rajesh Kumar
Output Redirection Default standard output: $ ls f1 f2 f3 Redirect output from a file: > $ ls > ls.out Redirecting and appending output to a file: >> $ who >> who.out www.scmGalaxy.com,  Author - Rajesh Kumar
Creating a file with cat While normally used to list the contents of files, using  cat  with  redirection can be used to create a file $ ls file1  file2 file3 Using redirection   $ cat > newfile file created by using the output redirection <ctrl-d> $ ls file1 file2 file3 newfile www.scmGalaxy.com,  Author - Rajesh Kumar
Error Redirection Default standard error: $  cat file1 file3 This is file1 cat: cannot open file2 Redirecting error output to a file: 2> (To append: 2>>) $  cat file1 file3  2>err This is file1 $ cat err cat: cannot open file2 $ cat file1 file3 2> /dev/null www.scmGalaxy.com,  Author - Rajesh Kumar
Combined Redirection Combined redirects: $  command > outfile  2>errfile <infile $  command >> appendfile 2 >> errorfile <infile Association Examples: $  command  > outfile 2 >&1  note: This is NOT the same as above $ command 2>&1 >outfile www.scmGalaxy.com,  Author - Rajesh Kumar
Split Outputs The  tee  command reads standard input and sends the data to both standard output and a file. Example: $ ls | tee ls.save | wc –l www.scmGalaxy.com,  Author - Rajesh Kumar
Module 9 Filters & other commands www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
grep Search  for lines matching specified  pattern syntax: grep [options]  pattern  [file1 file2  …..] Example: emp.dat Robin Bangalore John Chennai Rina Bangalore $ grep Bangalore emp.dat Robin Bangalore Rina Bangalore www.scmGalaxy.com,  Author - Rajesh Kumar
grep with Regular Expressions grep  ‘regular_expression’  file Valid metacharacters . Any single character * Zero or more occurences of the preceding character [aA] Enumeration: a or A [a-f] Any one of the characters in the range of a through f ^a Any lines that start with a z$ Any lines that end with z www.scmGalaxy.com,  Author - Rajesh Kumar
grep options -v print lines that  do not match -c print only a  count  of matching lines -l print only the  names  of the files with matching lines -n number  the matching lines -i  ignore the case  of letters when making comparisons -w do a  whole word  search www.scmGalaxy.com,  Author - Rajesh Kumar
sort command The sort command sorts lines and writes the result to standard output: $ sort  [ -t delimiter] [+field[.column]] [options] Options: -d sorts in dictionary order. Only letters, digits and  spaces are considered in comarisons -r reverses the order of the specified sort -n sorts numeric fields in arithmetic value www.scmGalaxy.com,  Author - Rajesh Kumar
sort examples $ cat animals dog.2 cat.4 elephant.10 rabbit.7 $ sort animals cat.4 dog.2 elephant.10 rabbit.7 $ cat animals | sort +0.1 rabbit.7 cat.4 elephant.10 dog.2 $ cat animals | sort -t. -n +1 dog.2 cat.4 rabbit.7 elephant.10 www.scmGalaxy.com,  Author - Rajesh Kumar
find command Search one or more directory structures for files that meet certain specified criteria Display the names of matching files or execute commands against those files find path expression Examples: $ find / -name file1 ---search for files in whole system with name file1 $ find / -user user1 – exec  rm { }  ---search for the  files owned by user1 and delete them $ find / -user user1 – ok  rm { }  ---search for the  files owned by user1 and delete them  interactively www.scmGalaxy.com,  Author - Rajesh Kumar
find options -type f ordinary file d directory -size +n larger than &quot;n&quot; blocks -n smaller than &quot;n&quot; blocks   n equal to &quot;n&quot; blocks -mtime +x modified more than &quot;x&quot; days ago -x modified less than &quot;x&quot; days ago -perm onum access permissions match &quot;onum&quot; mode access permissin match &quot;mode&quot;  -user user1 finds files owned by &quot;user1&quot; -o logical &quot;or&quot; -newer ref searches for files that are newer than the  reference file. www.scmGalaxy.com,  Author - Rajesh Kumar
cut command Used to cut fields from each line of a file or columns of a table cut –d: -f1,5 /etc/passwd cut –c2 test  second character of each line  cut –c-2 test    first 2 characters of each line www.scmGalaxy.com,  Author - Rajesh Kumar
tr command Used to substitute the values tr [a-z] [A-Z]   will convert each small letter to caps cat test | tr [a-z] [A-Z] will convert the small letters to caps in  display tr –s “ “   will squeeze multiple space occurences   of space into one www.scmGalaxy.com,  Author - Rajesh Kumar
ftp ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
The paste command Used to paste files vertically  eg. file1  file2 paste file1 file2 name address age name address age ram mvm 29 ram mvm 29 raghu rjnagar 25 raghu rjnagar 25 (To rearrange f1 f2 f3 to f3 f2 f1, cut each field,put into file then paste) By default paste uses the  tab  character for pasting files, but –d to specify one eg. paste –d  file1 file2  name address|age ram mvm|29 raghu rjnagar|25 www.scmGalaxy.com,  Author - Rajesh Kumar
The  split  command Used to split up the files: This command breaks up the input into several equi line segments. by defalult, split breaks a file into 1000 line pieces(or whatever is left) split creates files like xaa,xab,xac …. xaz then xba, xbb …. xbz  and … xzz . So there can be 676(26*26) files split –5 chap  (here the chap file is broken into files of 5 lines size) split chap small  (the file names will be smallaa,smallab …. smallzz) www.scmGalaxy.com,  Author - Rajesh Kumar
The uniq command ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
The  diff(Differential file comparator)  Command Analyzes text files Reports the differences between files diff [-options] file1 file2 www.scmGalaxy.com,  Author - Rajesh Kumar
The  cmp  command $ cmp names names.old names names.old differ: byte 6, line 1 $cmp -l names names.old 6  12  151 7  102  156 8  157  145 ... ... ... cmp: EOF on names www.scmGalaxy.com,  Author - Rajesh Kumar
The  file  command The file command tells the type of file Example: $ file /usr/bun/vi /usr/bin/vi:executable (RISC system/6000) or object module $ file c1 c1: ascii text $ file /usr/bin /usr/bin:  directory www.scmGalaxy.com,  Author - Rajesh Kumar
create a disk archive that contains a group of files or an entire directory structure -c  copy -x  extract -t  list [only one can be present at a time] -f  to specify the device name tar [–]cvf  etc.tar  /etc/* tar (tape archive program) www.scmGalaxy.com,  Author - Rajesh Kumar
tar –xvf tarfile Example:  tar –xvf etc.tar selective extraction tar –xvf  etc.tar /etc/passwd tar –tvf  etc.tar  will display the archive Restoring Files www.scmGalaxy.com,  Author - Rajesh Kumar
Module 10 Controlling Processes www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Monitoring Process The  ps  command dislays process status information $ ps -f UID PID PPID ... TTY ... COMMAND john 202 1 ... tty0 ... -ksh john 204 202 ... tty0 ... ksh john 210 204 ... yyu0 ... ls -R / john 212 204 ... tty0 ... ps -f www.scmGalaxy.com,  Author - Rajesh Kumar
Controlling Processes Foreground Processes: $ ls -lR / >lsout Background Processes: $ ls -lR / >lsout & www.scmGalaxy.com,  Author - Rajesh Kumar
Terminating Processes Foreground Processes: ctrl-c Interrupt key, cancels a forground  process kill Sometimes the kill command is used to  terminate foreground processes Background Processes: kill kill is the only way to terminate  background  processes www.scmGalaxy.com,  Author - Rajesh Kumar
Kill Signals Sig Meaning 01 hangup- you logged out while the process was  still running 02 interrupt- you pressed the interrupt(break) key  sequence ctrl-c 03 quit -you pressed the quit key sequence ctrl-09 Kill signal: The most powerful and risky signal that can be  sent Signal cannot be avoided or ignored! 15 Termination signal(Default): Stop a process Signal can be handled by programs www.scmGalaxy.com,  Author - Rajesh Kumar
Running Long Processes The nohup command will prevent a process from being killed if you log off the system before it completes: $ nohup ls -lR / >lsout &   [1] 100 If you do not redirect output, nohup will redirect output to a file nohup.out $ nohup ls -lR / &   [1] 102 Sending output to nohup.out www.scmGalaxy.com,  Author - Rajesh Kumar
Job Control jobs Lists all jobs <ctrl-z> Suspends foreground task fg %jobnumber Execute job in foreground bg %jobnumber Execute job in background stop %jobnumber Suspends background task www.scmGalaxy.com,  Author - Rajesh Kumar
Job Control Examples $ ls -R / > out 2> errfile & [1] 273 $ jobs [1]  +  Running ls -R / > out 2>errfile & $ fg %1 ls -R / > out 2>errfile <ctrl-z> [1] + Stopped (SIGTSTP) ls -R / >out 2>errfile & $ bg %1 % jobs [1] + Running  ls -R / >out 2>errfile & $ kill %1 [1] + Terminating  ls -R / >out 2>errfile & www.scmGalaxy.com,  Author - Rajesh Kumar
Module 11 Shell Programming Concepts www.scmGalaxy.com,  Author - Rajesh Kumar
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
echo & read commands echo   used to display messages on the screen read   used to accept values from the users, make  programming interactive  eg. echo “Enter ur name “ read name echo “Good Morning  $name” www.scmGalaxy.com,  Author - Rajesh Kumar
Command Line Arguments Shell programs can accept values through 1.  read  [Interactive –used when there are more inputs] 2. From the  command Line  when u execute it[Non  interactive- used when only a few inputs are there] For eg. sh1 20 30  Here 20 & 30 are the command Line  arguments.  Command Line args are stored in Positional parameters $1  contains the first argument,  $2  the second,  $3  the third etc. $0  contains the name of the file,  $#  stores the count of args  $*  displays all the args www.scmGalaxy.com,  Author - Rajesh Kumar
An example of Command Line args. #! /bin/bash echo “Program: $0” echo “The number of args specified is $#” echo “The args are $*” sh sh1 prog1 prog2 www.scmGalaxy.com,  Author - Rajesh Kumar
The parameter $? $? can be used to know the exit value of the previous command . This can be used in the shell scripts: www.scmGalaxy.com,  Author - Rajesh Kumar
The logical operators && and ||  These operators can be used to control the execution of command depending on the success/failure of the previous command eg. grep ‘director’  emp1.lst && echo “Pattern found in file” grep ‘manager’ emp2.lst || echo “pattern not found” or grep ‘director’ emp.lst’ && echo “Pattern found” || echo  “Pattern not found” www.scmGalaxy.com,  Author - Rajesh Kumar
exit : Script Termination exit  command used to prematurely terminate a program. It can even  take args.  eg.  grep “$1” $2 | exit 2 echo “Pattern found – Job over” www.scmGalaxy.com,  Author - Rajesh Kumar
The if Conditiona l if condition is true then execute commands else execute commands fi else is not a must  : if condition is true then execute commands fi   www.scmGalaxy.com,  Author - Rajesh Kumar
An example of if eg1:  if grep “director” emp.lst then echo “Pattern found” else echo “Pattern not found” fi Every  if  must have an accompanying  then  and  fi , and optionally  else www.scmGalaxy.com,  Author - Rajesh Kumar
Numeric comparison with  test test  is used to check a condition and return true or false Relational operators used by if Operator Meaning -eq Equal to -ne Not equal to -gt Greater than -ge Gfreater than or equal to -lt Less than -le Less than or equal to www.scmGalaxy.com,  Author - Rajesh Kumar
An example of  test  with numeric echo “Enter age” read age if test $age –ge 18  then echo “Major” else echo “Minor” fi www.scmGalaxy.com,  Author - Rajesh Kumar
[ ] short hand for  test echo “Enter age” read age if [ $age –ge 18 ]  then echo “Major” else echo “Minor” fi www.scmGalaxy.com,  Author - Rajesh Kumar
if –elif  :Multi-way Branching if condition echo “Enter marks” then execute commands read marks elif condition if [ $marks –ge 80 ] then execute commands then echo“Distinction” elif condition elif [ $marks –ge 60 ] then execute commands then echo “First Class” else execute conditions else echo “Pass” fi fi can have as many elif , else is optional www.scmGalaxy.com,  Author - Rajesh Kumar
test   String comparison test  with Strings uses = and != String Tests used by  test Test Exit Status -n str1 true if str1 is not a null string -z str1 true if str1 is a null string s1 = s2 true if s1 = s2 s1 != s2  true if s1 is not equal to s2 str1 true if str1 is assigned and not null www.scmGalaxy.com,  Author - Rajesh Kumar
file tests ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
The  case  CONDITIONAL case   used to match an expression for more than one alternatives and uses a compact construct to permit multi way branching case expression in pattern1) execute commands;; pattern2) execute commands esac www.scmGalaxy.com,  Author - Rajesh Kumar
An example for  case echo “1. List of files  2. Processes of user  2. Quit” echo “Enter choice” read choice case “$choice” in 1) ls ;; 2) ps –f ;; 3) exit;; *) echo “Wrong Choice” esac  www.scmGalaxy.com,  Author - Rajesh Kumar
case  Matching Multiple patterns echo “Do u want to continue (y/n) “ read answer case “$answer” in  y|Y) echo “Good” ;; n|N) exit ;; esac case can also use wildcards like [yY][eE]*  or [nN][oO] www.scmGalaxy.com,  Author - Rajesh Kumar
expr: Computation Shell doesn’t have any compute features-depend on  expr expr 3 + 5 expr $x + $y expr $x - $y expr $x  $y expr &x / $y expr $x % $y division gives only integers  as expr  can handle only integers www.scmGalaxy.com,  Author - Rajesh Kumar
Command Substitution x=5 x=`expr $x +1` echo $x it will give 6 www.scmGalaxy.com,  Author - Rajesh Kumar
sleep & wait sleep 100  the program sleeps for 100 seconds wait wait for completion of all background processes wait 138  wait for completion of the process 138 www.scmGalaxy.com,  Author - Rajesh Kumar
while loop while condition is true do execute commands done eg. x=1 while test $x -le 10 do echo $x x=`expr $x + 1` done ( while true will set infinite condition) www.scmGalaxy.com,  Author - Rajesh Kumar
until : while’s complement x=1 until test $x –gt 10 do echo $x x=`expr $x + 1` done www.scmGalaxy.com,  Author - Rajesh Kumar
For loop for variable in list do execute commands done eg. for x in 1 2 3 4 5 do echo “Value of x is $x” done www.scmGalaxy.com,  Author - Rajesh Kumar
The list in for loop ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Labs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Labs  contd. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar
Labs  contd. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],www.scmGalaxy.com,  Author - Rajesh Kumar

Mais conteúdo relacionado

Mais procurados

Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commandsSagar Kumar
 
Unix Operating System
Unix Operating SystemUnix Operating System
Unix Operating Systemsubhsikha
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examplesabclearnn
 
Operating systems unix
Operating systems   unixOperating systems   unix
Operating systems unixAchu dhan
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programmingsudhir singh yadav
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Ahmed El-Arabawy
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsAhmed El-Arabawy
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSvtunotesbysree
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linuxshravan saini
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Ahmed El-Arabawy
 

Mais procurados (20)

Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Unix Operating System
Unix Operating SystemUnix Operating System
Unix Operating System
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Operating systems unix
Operating systems   unixOperating systems   unix
Operating systems unix
 
Linux commands
Linux commands Linux commands
Linux commands
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
 
Unix - An Introduction
Unix - An IntroductionUnix - An Introduction
Unix - An Introduction
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 

Destaque

Unix operating system
Unix operating systemUnix operating system
Unix operating systemABhay Panchal
 
Unix OS & Commands
Unix OS & CommandsUnix OS & Commands
Unix OS & CommandsMohit Belwal
 
UNIX Operating System
UNIX Operating SystemUNIX Operating System
UNIX Operating SystemUnless Yuriko
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Scriptsbmguys
 
Unix operating system
Unix operating systemUnix operating system
Unix operating systemmidhunjose4u
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commandsaaj_sarkar06
 
Unix
UnixUnix
UnixErm78
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)meashi
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity TipsKeith Bennett
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02duquoi
 
Unix memory management
Unix memory managementUnix memory management
Unix memory managementTech_MX
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt onu9
 
UNIX and Linux - an introduction by Mathias Homann
UNIX and Linux - an introduction by Mathias HomannUNIX and Linux - an introduction by Mathias Homann
UNIX and Linux - an introduction by Mathias HomannMathias Homann
 
A beginners introduction to unix
A beginners introduction to unixA beginners introduction to unix
A beginners introduction to unixzafarali1981
 
Linux ppt
Linux pptLinux ppt
Linux pptlincy21
 

Destaque (20)

Unix operating system
Unix operating systemUnix operating system
Unix operating system
 
Unix slideshare
Unix slideshareUnix slideshare
Unix slideshare
 
Unix OS & Commands
Unix OS & CommandsUnix OS & Commands
Unix OS & Commands
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
 
UNIX Operating System
UNIX Operating SystemUNIX Operating System
UNIX Operating System
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
 
Unix
UnixUnix
Unix
 
Introduction to unix
Introduction to unixIntroduction to unix
Introduction to unix
 
Unix operating system
Unix operating systemUnix operating system
Unix operating system
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
 
Unix
UnixUnix
Unix
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity Tips
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02
 
Unix memory management
Unix memory managementUnix memory management
Unix memory management
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
Vi editor in linux
Vi editor in linuxVi editor in linux
Vi editor in linux
 
UNIX and Linux - an introduction by Mathias Homann
UNIX and Linux - an introduction by Mathias HomannUNIX and Linux - an introduction by Mathias Homann
UNIX and Linux - an introduction by Mathias Homann
 
A beginners introduction to unix
A beginners introduction to unixA beginners introduction to unix
A beginners introduction to unix
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 

Semelhante a Basic Unix (20)

55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
 
Linux
LinuxLinux
Linux
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
Linux
LinuxLinux
Linux
 
Basics of Linux
Basics of LinuxBasics of Linux
Basics of Linux
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administrator
 
Using filesystem capabilities with rsync
Using filesystem capabilities with rsyncUsing filesystem capabilities with rsync
Using filesystem capabilities with rsync
 
Unix Security
Unix SecurityUnix Security
Unix Security
 
Introduction To Unix
Introduction To UnixIntroduction To Unix
Introduction To Unix
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux
LinuxLinux
Linux
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
 
Unix notes
Unix notesUnix notes
Unix notes
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
Linux
LinuxLinux
Linux
 
Tuan Q. Phan - WESST - Getting Started on the Computational Social Sciences
Tuan Q. Phan - WESST - Getting Started on the Computational Social SciencesTuan Q. Phan - WESST - Getting Started on the Computational Social Sciences
Tuan Q. Phan - WESST - Getting Started on the Computational Social Sciences
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Lnx
LnxLnx
Lnx
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 

Mais de Rajesh Kumar

Fundamental of apache maven
Fundamental of apache mavenFundamental of apache maven
Fundamental of apache mavenRajesh Kumar
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamentalRajesh Kumar
 
Tools for quality matrix and kloc
Tools for quality matrix and klocTools for quality matrix and kloc
Tools for quality matrix and klocRajesh Kumar
 
Testing in a glance
Testing in a glanceTesting in a glance
Testing in a glanceRajesh Kumar
 
Code coverage & tools
Code coverage & toolsCode coverage & tools
Code coverage & toolsRajesh Kumar
 
Scm process assessment guide
Scm process assessment guideScm process assessment guide
Scm process assessment guideRajesh Kumar
 
Branching and Merging Practices
Branching and Merging Practices Branching and Merging Practices
Branching and Merging Practices Rajesh Kumar
 
SCM Process and smartBuild
SCM Process and smartBuildSCM Process and smartBuild
SCM Process and smartBuildRajesh Kumar
 
Version Control With CVS
Version Control With CVSVersion Control With CVS
Version Control With CVSRajesh Kumar
 
Using Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsUsing Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsRajesh Kumar
 
Software Configuration Management And CVS
Software Configuration Management And CVSSoftware Configuration Management And CVS
Software Configuration Management And CVSRajesh Kumar
 
Scm With Mks Integrity
Scm With Mks IntegrityScm With Mks Integrity
Scm With Mks IntegrityRajesh Kumar
 
Introduction To Software Configuration Management
Introduction To Software Configuration ManagementIntroduction To Software Configuration Management
Introduction To Software Configuration ManagementRajesh Kumar
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To AntRajesh Kumar
 

Mais de Rajesh Kumar (20)

Fundamental of apache maven
Fundamental of apache mavenFundamental of apache maven
Fundamental of apache maven
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamental
 
Tools for quality matrix and kloc
Tools for quality matrix and klocTools for quality matrix and kloc
Tools for quality matrix and kloc
 
Cast vs sonar
Cast vs sonarCast vs sonar
Cast vs sonar
 
Cast vs sonar
Cast vs sonarCast vs sonar
Cast vs sonar
 
Testing in a glance
Testing in a glanceTesting in a glance
Testing in a glance
 
Rpm cheatbook
Rpm cheatbookRpm cheatbook
Rpm cheatbook
 
Code coverage & tools
Code coverage & toolsCode coverage & tools
Code coverage & tools
 
Scm process assessment guide
Scm process assessment guideScm process assessment guide
Scm process assessment guide
 
Cruise control
Cruise controlCruise control
Cruise control
 
Cloud computer
Cloud computerCloud computer
Cloud computer
 
Branching and Merging Practices
Branching and Merging Practices Branching and Merging Practices
Branching and Merging Practices
 
SCM Process and smartBuild
SCM Process and smartBuildSCM Process and smartBuild
SCM Process and smartBuild
 
Why Scm
Why ScmWhy Scm
Why Scm
 
Version Control With CVS
Version Control With CVSVersion Control With CVS
Version Control With CVS
 
Using Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee ApplicationsUsing Ant To Build J2 Ee Applications
Using Ant To Build J2 Ee Applications
 
Software Configuration Management And CVS
Software Configuration Management And CVSSoftware Configuration Management And CVS
Software Configuration Management And CVS
 
Scm With Mks Integrity
Scm With Mks IntegrityScm With Mks Integrity
Scm With Mks Integrity
 
Introduction To Software Configuration Management
Introduction To Software Configuration ManagementIntroduction To Software Configuration Management
Introduction To Software Configuration Management
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
 

Último

AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 

Último (20)

AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 

Basic Unix

  • 1. UNIX Basics www.scmGalaxy.com Author: Rajesh Kumar www.scmGalaxy.com, Author - Rajesh Kumar
  • 2. Contents 1.Introduction to Unix 03 - 11 2. Logging In and Basic Commands 12 - 26 3File system 27 - 45 4.managing files 46 - 55 5.File Access Permissions 56 - 68 6.vi Editor 69 - 78 7.Shell Basics 79 – 94 8. Standard I/O Redirection 95 – 103 9. Filters & some utilities 104 – 123 10. Controlling Processes 124 – 132 11. Shell Programming concepts 133 - 158 12. Labs 159 - 161 www.scmGalaxy.com, Author - Rajesh Kumar
  • 3. Introduction to Unix Module 1 www.scmGalaxy.com, Author - Rajesh Kumar
  • 4.
  • 5.
  • 6.
  • 7. UNIX Architecture – Kernel & Shell Shell Kernel Hardware User www.scmGalaxy.com, Author - Rajesh Kumar
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Logging In and Basic Commands Module 2 www.scmGalaxy.com, Author - Rajesh Kumar
  • 13.
  • 14.
  • 15. Logging In and Out telnet 192.168.10.1 User: Password: exit or <ctrl>+<d> will terminate the login session www.scmGalaxy.com, Author - Rajesh Kumar
  • 16.
  • 17. $ echo 'hi >Good Morning‘ > is the default secondary prompt The Secondary Prompt www.scmGalaxy.com, Author - Rajesh Kumar
  • 18. Content of the Manual Pages NAME WARNINGS SYNOPSIS EXAMPLES DESCRIPTION AUTHOR RETURN VALUE FILES ERRORS SEE ALSO BUGS etc. www.scmGalaxy.com, Author - Rajesh Kumar
  • 19. Syntax: man –[k|X] keyword in which X is the number of one of the manual sections Examples: $ man ls Display the “ls&quot; man page. $ man -k cat Display entries with keyword &quot;cat&quot;. $ man passwd Display the &quot;passwd&quot; man page-Section 1. $ man 4 passwd Display the &quot;passwd&quot; man page-Section 4. The Online Manual www.scmGalaxy.com, Author - Rajesh Kumar
  • 20. Syntax: id Displays effective user and group identification for session Example: $id uid =303 (user3) gid=300 (class) The id Command www.scmGalaxy.com, Author - Rajesh Kumar
  • 21. Syntax : who Reports information about users who are currently logged on to a system Examples: $ who root tty1p5 Jul 01 08:01 user11 tty1p4 Jul 01 09:59 user12 tty0p3 Jul 01 10:01 $ who am i user12 tty0p3 Jul 01 10:01 $ whoami user12 The who Command www.scmGalaxy.com, Author - Rajesh Kumar
  • 22. Syntax: date Reports the date and time Example: $ date Fri Jul 1 11:15:55 EDT 2005 The date Command www.scmGalaxy.com, Author - Rajesh Kumar
  • 23. Syntax: cal Reports the calendar of 2005 September(Current month) Example: $ cal 8 2005 for Aug 2005 $ cal 2005 for the full calendar of year 2005 The cal Command www.scmGalaxy.com, Author - Rajesh Kumar
  • 24. Syntax: passwd Assigns a login password Example: $ passwd Changing password for user1 Old password: New password: Re-enter new password: The passwd Command www.scmGalaxy.com, Author - Rajesh Kumar
  • 25. The clear Command Syntax: clear Clears terminal screen www.scmGalaxy.com, Author - Rajesh Kumar
  • 26. finger Finger: Displays information about the users currently logged on Eg: $ finger user1 Login name: user1 Directory: /export/home/user1 shell:/usr/bin/sh On since Sep 05 09:10:12 on tty1 No plan www.scmGalaxy.com, Author - Rajesh Kumar
  • 27. File System Module 3 www.scmGalaxy.com, Author - Rajesh Kumar
  • 28.
  • 29. What Is a File System? collection of control structures and Data blocks that occupy the space defined by a partition and allow for the storage and management of data. Data + Meta data www.scmGalaxy.com, Author - Rajesh Kumar
  • 30. a File System structure www.scmGalaxy.com, Author - Rajesh Kumar Primary Superblock Backup Superblock Cylinder Group Block Inode Table Data Blocks
  • 31. Hard Link Allows a file to have more than one name and yet maintain a single copy on the disk. All the links have the same inode number Eg: $ ls –i f1 1113 f1 $ ln f1 f1.lnk $ ls –i f1.lnk 1113 f1.lnk www.scmGalaxy.com, Author - Rajesh Kumar
  • 32. a File Types Common File Types: Ordinary files: regular files Directory files: table of contents, that stores a list of files/directories within that directory Device files: For every device there is a device file used by kernel to interact with the device. Symbolic Link: Its link to other files www.scmGalaxy.com, Author - Rajesh Kumar
  • 33. a Ordinary Files A regular file simply holds data. Regular files can hold ASCII text, binary data, image data, databases, application-related data, and more. www.scmGalaxy.com, Author - Rajesh Kumar
  • 34. a Directory Files Directory Inode Table name inum # type mode links user group date size loc d1 4 4 dir 755 2 user1 group1 Sep 5 9:30 512 f1 10 10 file 644 1 user1 group1 Sep 5 9:45 12 www.scmGalaxy.com, Author - Rajesh Kumar
  • 35. a Symbolic Links contains the path of the file to which it links Exists even after the source file is removed and is exactly similar to Windows shortcut Syntax: ln –s soucefile linkfile Eg: ln -s /f1 f1.lnk Overcomes 2 limitations of Hard Link: 1. possible across filesystems 2. can link to a directory www.scmGalaxy.com, Author - Rajesh Kumar
  • 36. a Device files A device file provides access to a device. # cd /devices/pci@1f,0/pci@1,1/ide@3 # ls -l brw------- 1 root sys 136, 0 Apr 3 11:11 dad@0,0:a Two types of device files: block device files character device file www.scmGalaxy.com, Author - Rajesh Kumar
  • 37. The File System Hierarchy / usr etc devices dev var tmp bin sbin ls who adm sadm dsk rdsk www.scmGalaxy.com, Author - Rajesh Kumar
  • 38. a system directories / :root directory, top level directory /bin : user commands like cp, cron, cmp etc.. /usr/sbin: admin commands /dev : logical device files of all hardware devices /devices: physical device files /etc : System configuration files and user database /tmp : to store temporary files /usr : the binaries, shared libraries, shared documentation etc. /var: stores the log files and dynamic files www.scmGalaxy.com, Author - Rajesh Kumar
  • 39. a File Path name A sequence of file names, separated by slashes (/), that describes the path, the system must follow to locate a file in the file system Absolute pathname (start from the /-directory): Eg: /export/home/user1/file1 Relative pathname (start from the current directory) ./test1 (. = current directory) ../team03/.profile (.. = parent directory) www.scmGalaxy.com, Author - Rajesh Kumar
  • 40. pwd - Present Working Directory pwd prints the Current Directory www.scmGalaxy.com, Author - Rajesh Kumar
  • 41. 6 Syntax: ls [-adlFR] [ pathname(s)] Example: $ ls f1 f2 memo $ ls -F f1 f2* memo/ $ ls -aF profile f1 f2* memo/ $ ls memo f1 f2 ls - List Contents of a Directory www.scmGalaxy.com, Author - Rajesh Kumar
  • 42. cd Change Directory Example: $ pwd /home/user3 $ cd memo; pwd / home/user3/memo $ cd ../..; pwd /home $ cd /tmp; pwd /tmp syntax: cd [dir_name] www.scmGalaxy.com, Author - Rajesh Kumar
  • 43. mkdir, rmdir – create & remove Directories Syntax: mkdir directory eg: $ mkdir d1 syntax: rmdir dir eg: $ rmdir /export/home/user1 www.scmGalaxy.com, Author - Rajesh Kumar
  • 44. working with Multiple Directories Create multiple directories simultaneously: $ mkdir -p dir1/dir2/dir3 Remove a directory and all its subdirectories $ rmdir -p dir1/dir2/dir3 www.scmGalaxy.com, Author - Rajesh Kumar
  • 45. The touch Command Updates the atime and mtime of a file if it exists. Else create an empty file Example: $ ls –l -rw-r—r-- 1 user1 group1 100 Sep 5 09:30 test $date Mon, Sep 5 10:00 2005 $ touch test file1 $ ls -l -rw-r—r-- 1 user1 group1 100 Sep 5 10:00 test -rw-r—r-- 1 user1 group1 100 Sep 5 10:00 file1 www.scmGalaxy.com, Author - Rajesh Kumar
  • 46. Managing Files Module 4 www.scmGalaxy.com, Author - Rajesh Kumar
  • 47.
  • 48. File Characteristics File Type Permissions Links Owner Group Size Timestamp Name $ ls -l -rw-r--r-- 1 user3 class 37 Jul 24 11:06 f1 -rwxr-xr-x 1 user3 class 52 Jul 24 11:08 f2 drwxr-xr-x 2 user3 class 1024 Jul 24 12:03 memo www.scmGalaxy.com, Author - Rajesh Kumar
  • 49. Syntax: cat [ file...] Concatenate and display the contents of file(s) Examples: $ cat remind Your mother's birthday is November 29. $ cat note remind The meeting is scheduled for July 29. Your mother's birthday is November 29. $ cat abc abc 1234 1234 cat - Display the Contents of a File www.scmGalaxy.com, Author - Rajesh Kumar CTRL + D
  • 50. Syntax: more [ filename]... Display files one screen at a time Example: $ more funfile . . . --funfile (20%)-- Q or q Quit more Return One more line Space bar One more page more - Display the Contents of a File www.scmGalaxy.com, Author - Rajesh Kumar
  • 51. Syntax: tail [- n] [filename]... Display the end of file(s) Example: $ tail -1 test soon as it is available. tail - Display the End of a File www.scmGalaxy.com, Author - Rajesh Kumar
  • 52. wc command The wc command counts the number of lines, words and bytes in a named file: syntax: wc [-c] [-l] [-w] filename Options: -c counts the number of bytes -l counts lines -w counts words Example: $wc testfile 10 98 1000 testfile www.scmGalaxy.com, Author - Rajesh Kumar
  • 53. Syntax: cp [-i] file1 new_file Copy a file cp [-i] file [file...] dest_dir Copy files to a directory cp -r [-i] dir [dir...] dest_dir Copy directories Example: cp file1 d1 copies file1 to d1 directory cp file2 file3 create a copy of file2 as file3 in the same directory cp - Copy Files www.scmGalaxy.com, Author - Rajesh Kumar
  • 54. Syntax: mv [-i] file new_file Rename a file mv [-i] file [file...] dest_dir Move files to a directory mv [-i] dir [dir...] dest_dir Rename or move directories Example: $ ls -F $ mv note remind memo f1 f2* memo/ note remind $ ls -F $ mv f1 file1 file1 memo/ $ ls -F $ls -F memo file1 f2* memo/ note remind file2* note remind $ mv f2 memo/file2 $ mv memo letters $ ls -F $ ls -F file1 memo/ note remind file1 letters/ $ ls -F memo file2* mv - Move or Rename Files www.scmGalaxy.com, Author - Rajesh Kumar
  • 55. Syntax: rm [-if] filename [filename...] Remove files rm -r[if] dirname [filename...] Remove directories Examples: rm f1 removes the file f1 rm –r d1 remove the directory. rm - Remove Files www.scmGalaxy.com, Author - Rajesh Kumar
  • 56. File Access Permissions Module 5 www.scmGalaxy.com, Author - Rajesh Kumar
  • 57.
  • 58. File Permissions and Access Access to files is dependent on a user's identification and the permissions associated with a file. This module will show how to Understand the read, write, and execute access to a file Permissions ls (11, ls -l) chmod umask chown chgrp su Determine what access is granted on a file Change the file access Change default file access Change the owner of a file Change the group of a file Switch your user identifier www.scmGalaxy.com, Author - Rajesh Kumar
  • 59.
  • 60.
  • 61. Change Permissions (Symbolic Notation) Syntax: chmod mode_list file... Change permissions of file(s) mode_list [who[operator]permission] [ ,... ] who user, group, other or all(u/g/a) operator + (add), - (subtract), = (set equal to) permission read, write, execute Example: Original permissions: mode user group other rw-r--r-- rw- r-- r-- $ chmod u+x,g+x,o+x file or $ chmod +x file Final permissions: mode user group other rwxr-xr-x rwx r-x r-x www.scmGalaxy.com, Author - Rajesh Kumar
  • 62. Change Permissions(Octal Notation) File and directory permissions can also be specified as an octal number: Read Permission :4 Write Permission :2 Execute Permission:1 We can just add the numbers to specify the permission for each category Example: 6 means read and write, 7 means read, write and execute eg: $ chmod 664 f1 will give read and write permissions for owner and group while only read for others www.scmGalaxy.com, Author - Rajesh Kumar
  • 63. Default Permissions The default protections for newly created files and directories are: File -rw-r—r-- 644 Directory drwxr-xr-x 755 These default settings may be modified by changing the umask value. www.scmGalaxy.com, Author - Rajesh Kumar
  • 64. umask - Permission Mask Umask specifies what permission bits will be set on a new file or directory when created. New Directory: 777 – 022 755  rwxr-xr-x New File : 666 – 022 644  rw-r—r— The default value of umask is set in /etc/profile. This can be changed for all the users or a particular user www.scmGalaxy.com, Author - Rajesh Kumar
  • 65. chown - Change File Ownership Syntax: chown owner [:group] filename ... Example: $ id uid=101 (user1), gid=101 (group1) $ cp f1 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----- 1 user1 group1 3967 Jan 24 13:13 f1 $ chown user2 /tmp/user2/f1 $ ls -l /tmp/user2/f1 -rw-r----- 1 user2 class 3967 Jan 24 13:13 f1 Only the owner of a file (or root) can change the ownership of the file. Changes owner of a file(s) and, optionally, the group ID www.scmGalaxy.com, Author - Rajesh Kumar
  • 66. The chgrp Command Syntax: chgrp newgroup filename ... Example: $ id uid=303 (user3), gid=300 (class) $ ls -l f3 -rw-r----- 1 user3 class 3967 Jan 24 13:13 f3 $ chgrp class2 f3 $ ls -l f3 -rw-r----- 1 user3 class2 3967 Jan 24 13:13 f3 $ chown user2 f3 $ ls -l f3 -rw-r----- 1 user2 class2 3967 Jan 24 13:13 f3 www.scmGalaxy.com, Author - Rajesh Kumar
  • 67. su - Switch User Id Syntax: su [ user_name] Example: $ ls -l f1 -rwxr-x--- 1 user1 group1 3967 Jan 24 23:13 class_setup $ id uid=303 (user1), gid=300 (group1) $ su – user2 Password: $ id uid=400 (user2), gid=300 (group1) Change your effective user ID and group ID www.scmGalaxy.com, Author - Rajesh Kumar
  • 68.
  • 69. vi Editor Module 6 www.scmGalaxy.com, Author - Rajesh Kumar
  • 70.
  • 71.
  • 72. Starting and Ending a vi Session vi [filename] Start a vi edit session of file Example: $ vi testfile - If the file doesn’t exist, it will be created - Otherwise vi will open the existing file All modifications are made to the copy of the file brought into memory. :wq or :x or <shift-zz> write and quit :w write :q quit :q! Quit without saving www.scmGalaxy.com, Author - Rajesh Kumar
  • 73. Cursor Control Commands $ w,W l <right-arrow> <down-arrow> j L <ctrl-f> G 1G <ctrl-b> H k <up-arrow> 0 b,B h <left-arrow> www.scmGalaxy.com, Author - Rajesh Kumar
  • 74.
  • 75. Deleting Text: x, dw, dd, dG x  deletes the current character dw  deletes the current word dd  deletes the current line dG delete all lines to end of file, including current line. With any of these you can prefix a number Example: 3dd will delete 3 lines d$  to delete to the end of the line d0 to delete to the start of the line www.scmGalaxy.com, Author - Rajesh Kumar
  • 76. Copying, moving and changing Text yy copy the line yw copy the word p will paste the yanked lines below dw cut the word P will paste the yanked lines above   dd cut the line r will overwrite the current character R will replace all text on the right of the cursor position cw will replace only the current word www.scmGalaxy.com, Author - Rajesh Kumar
  • 77. Searching for Text: /, n, N /director will locate for the first occurrence of the pattern ‘director’ n to locate the next occurrence N to locate the previous occurence www.scmGalaxy.com, Author - Rajesh Kumar
  • 78. Find and Replace To find and replace the word director with member : : 1,$s/director/member/g 1,$ represents all lines in the file g makes it truly global. g will ensure that all occuences in each line is replaced. Without g only the first occurrence of each line will be replaced. www.scmGalaxy.com, Author - Rajesh Kumar
  • 79. Shell Features Module 7 www.scmGalaxy.com, Author - Rajesh Kumar
  • 80.
  • 81.
  • 82. /bin/bash /bin/ksh /bin/sh /bin/csh /bin/rksh /bin/rsh /bin/tcsh /bin/zsh Bash shell Korn shell Bourne shell C Shell Restricted Korn shell Restricted Bourne shell An amended version of the C shell The Z shell Commonly Used Shells www.scmGalaxy.com, Author - Rajesh Kumar
  • 83.
  • 84. Syntax: alias [ name[=string]] Examples: $ alias dir=ls $ alias mroe=more $ alias mstat=/home/tricia/projects/micron/status $ alias laser=&quot;lp -dlaser&quot; $ laser fileX request id is laser-234 (1 file) $ alias displays aliases currently defined $ alias mroe displays value of alias mroe mroe=more Aliasing www.scmGalaxy.com, Author - Rajesh Kumar
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90. $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin $ PATH=$PATH:$HOME:. $ echo $PATH /usr/bin:/usr/contrib/bin:/usr/local/bin:/home/user3:. $ echo $HOME /home/user3 $ file_name=$HOME/file1 $ more $file_name <contents of /home/user3/file1> Variable Substitution www.scmGalaxy.com, Author - Rajesh Kumar
  • 91. Syntax: $( command) Example: $ dt=date This will store the string date in the variable dt not the value $ dt=$(date) This will do command substitution and store the result of date command in the variable dt note: instead of $(date) we can also use `date` Command Substitution www.scmGalaxy.com, Author - Rajesh Kumar
  • 92.
  • 93. Transferring Local Variables to the Environment Syntax: export variable Transfer variable to environment www.scmGalaxy.com, Author - Rajesh Kumar
  • 94.
  • 95. Standard I/O Redirection Module 8 www.scmGalaxy.com, Author - Rajesh Kumar
  • 96.
  • 97. The Standard Files Standard Input File (0) Keyboard Standard Output File (1) Monitor Standard Error File (2) Monitor operators: standard input redirection 0< or < standard output redirection 1> or > standard Error redirection 2> www.scmGalaxy.com, Author - Rajesh Kumar
  • 98. Input Redirection Default standard input $ mail user1 subject: Hi Test mail <ctrl-d> Redirect Input from a file: < $ mail user1 < letter www.scmGalaxy.com, Author - Rajesh Kumar
  • 99. Output Redirection Default standard output: $ ls f1 f2 f3 Redirect output from a file: > $ ls > ls.out Redirecting and appending output to a file: >> $ who >> who.out www.scmGalaxy.com, Author - Rajesh Kumar
  • 100. Creating a file with cat While normally used to list the contents of files, using cat with redirection can be used to create a file $ ls file1 file2 file3 Using redirection $ cat > newfile file created by using the output redirection <ctrl-d> $ ls file1 file2 file3 newfile www.scmGalaxy.com, Author - Rajesh Kumar
  • 101. Error Redirection Default standard error: $ cat file1 file3 This is file1 cat: cannot open file2 Redirecting error output to a file: 2> (To append: 2>>) $ cat file1 file3 2>err This is file1 $ cat err cat: cannot open file2 $ cat file1 file3 2> /dev/null www.scmGalaxy.com, Author - Rajesh Kumar
  • 102. Combined Redirection Combined redirects: $ command > outfile 2>errfile <infile $ command >> appendfile 2 >> errorfile <infile Association Examples: $ command > outfile 2 >&1 note: This is NOT the same as above $ command 2>&1 >outfile www.scmGalaxy.com, Author - Rajesh Kumar
  • 103. Split Outputs The tee command reads standard input and sends the data to both standard output and a file. Example: $ ls | tee ls.save | wc –l www.scmGalaxy.com, Author - Rajesh Kumar
  • 104. Module 9 Filters & other commands www.scmGalaxy.com, Author - Rajesh Kumar
  • 105.
  • 106. grep Search for lines matching specified pattern syntax: grep [options] pattern [file1 file2 …..] Example: emp.dat Robin Bangalore John Chennai Rina Bangalore $ grep Bangalore emp.dat Robin Bangalore Rina Bangalore www.scmGalaxy.com, Author - Rajesh Kumar
  • 107. grep with Regular Expressions grep ‘regular_expression’ file Valid metacharacters . Any single character * Zero or more occurences of the preceding character [aA] Enumeration: a or A [a-f] Any one of the characters in the range of a through f ^a Any lines that start with a z$ Any lines that end with z www.scmGalaxy.com, Author - Rajesh Kumar
  • 108. grep options -v print lines that do not match -c print only a count of matching lines -l print only the names of the files with matching lines -n number the matching lines -i ignore the case of letters when making comparisons -w do a whole word search www.scmGalaxy.com, Author - Rajesh Kumar
  • 109. sort command The sort command sorts lines and writes the result to standard output: $ sort [ -t delimiter] [+field[.column]] [options] Options: -d sorts in dictionary order. Only letters, digits and spaces are considered in comarisons -r reverses the order of the specified sort -n sorts numeric fields in arithmetic value www.scmGalaxy.com, Author - Rajesh Kumar
  • 110. sort examples $ cat animals dog.2 cat.4 elephant.10 rabbit.7 $ sort animals cat.4 dog.2 elephant.10 rabbit.7 $ cat animals | sort +0.1 rabbit.7 cat.4 elephant.10 dog.2 $ cat animals | sort -t. -n +1 dog.2 cat.4 rabbit.7 elephant.10 www.scmGalaxy.com, Author - Rajesh Kumar
  • 111. find command Search one or more directory structures for files that meet certain specified criteria Display the names of matching files or execute commands against those files find path expression Examples: $ find / -name file1 ---search for files in whole system with name file1 $ find / -user user1 – exec rm { } ---search for the files owned by user1 and delete them $ find / -user user1 – ok rm { } ---search for the files owned by user1 and delete them interactively www.scmGalaxy.com, Author - Rajesh Kumar
  • 112. find options -type f ordinary file d directory -size +n larger than &quot;n&quot; blocks -n smaller than &quot;n&quot; blocks n equal to &quot;n&quot; blocks -mtime +x modified more than &quot;x&quot; days ago -x modified less than &quot;x&quot; days ago -perm onum access permissions match &quot;onum&quot; mode access permissin match &quot;mode&quot; -user user1 finds files owned by &quot;user1&quot; -o logical &quot;or&quot; -newer ref searches for files that are newer than the reference file. www.scmGalaxy.com, Author - Rajesh Kumar
  • 113. cut command Used to cut fields from each line of a file or columns of a table cut –d: -f1,5 /etc/passwd cut –c2 test second character of each line cut –c-2 test first 2 characters of each line www.scmGalaxy.com, Author - Rajesh Kumar
  • 114. tr command Used to substitute the values tr [a-z] [A-Z] will convert each small letter to caps cat test | tr [a-z] [A-Z] will convert the small letters to caps in display tr –s “ “ will squeeze multiple space occurences of space into one www.scmGalaxy.com, Author - Rajesh Kumar
  • 115.
  • 116. The paste command Used to paste files vertically eg. file1 file2 paste file1 file2 name address age name address age ram mvm 29 ram mvm 29 raghu rjnagar 25 raghu rjnagar 25 (To rearrange f1 f2 f3 to f3 f2 f1, cut each field,put into file then paste) By default paste uses the tab character for pasting files, but –d to specify one eg. paste –d file1 file2 name address|age ram mvm|29 raghu rjnagar|25 www.scmGalaxy.com, Author - Rajesh Kumar
  • 117. The split command Used to split up the files: This command breaks up the input into several equi line segments. by defalult, split breaks a file into 1000 line pieces(or whatever is left) split creates files like xaa,xab,xac …. xaz then xba, xbb …. xbz and … xzz . So there can be 676(26*26) files split –5 chap (here the chap file is broken into files of 5 lines size) split chap small (the file names will be smallaa,smallab …. smallzz) www.scmGalaxy.com, Author - Rajesh Kumar
  • 118.
  • 119. The diff(Differential file comparator) Command Analyzes text files Reports the differences between files diff [-options] file1 file2 www.scmGalaxy.com, Author - Rajesh Kumar
  • 120. The cmp command $ cmp names names.old names names.old differ: byte 6, line 1 $cmp -l names names.old 6 12 151 7 102 156 8 157 145 ... ... ... cmp: EOF on names www.scmGalaxy.com, Author - Rajesh Kumar
  • 121. The file command The file command tells the type of file Example: $ file /usr/bun/vi /usr/bin/vi:executable (RISC system/6000) or object module $ file c1 c1: ascii text $ file /usr/bin /usr/bin: directory www.scmGalaxy.com, Author - Rajesh Kumar
  • 122. create a disk archive that contains a group of files or an entire directory structure -c copy -x extract -t list [only one can be present at a time] -f to specify the device name tar [–]cvf etc.tar /etc/* tar (tape archive program) www.scmGalaxy.com, Author - Rajesh Kumar
  • 123. tar –xvf tarfile Example: tar –xvf etc.tar selective extraction tar –xvf etc.tar /etc/passwd tar –tvf etc.tar will display the archive Restoring Files www.scmGalaxy.com, Author - Rajesh Kumar
  • 124. Module 10 Controlling Processes www.scmGalaxy.com, Author - Rajesh Kumar
  • 125.
  • 126. Monitoring Process The ps command dislays process status information $ ps -f UID PID PPID ... TTY ... COMMAND john 202 1 ... tty0 ... -ksh john 204 202 ... tty0 ... ksh john 210 204 ... yyu0 ... ls -R / john 212 204 ... tty0 ... ps -f www.scmGalaxy.com, Author - Rajesh Kumar
  • 127. Controlling Processes Foreground Processes: $ ls -lR / >lsout Background Processes: $ ls -lR / >lsout & www.scmGalaxy.com, Author - Rajesh Kumar
  • 128. Terminating Processes Foreground Processes: ctrl-c Interrupt key, cancels a forground process kill Sometimes the kill command is used to terminate foreground processes Background Processes: kill kill is the only way to terminate background processes www.scmGalaxy.com, Author - Rajesh Kumar
  • 129. Kill Signals Sig Meaning 01 hangup- you logged out while the process was still running 02 interrupt- you pressed the interrupt(break) key sequence ctrl-c 03 quit -you pressed the quit key sequence ctrl-09 Kill signal: The most powerful and risky signal that can be sent Signal cannot be avoided or ignored! 15 Termination signal(Default): Stop a process Signal can be handled by programs www.scmGalaxy.com, Author - Rajesh Kumar
  • 130. Running Long Processes The nohup command will prevent a process from being killed if you log off the system before it completes: $ nohup ls -lR / >lsout & [1] 100 If you do not redirect output, nohup will redirect output to a file nohup.out $ nohup ls -lR / & [1] 102 Sending output to nohup.out www.scmGalaxy.com, Author - Rajesh Kumar
  • 131. Job Control jobs Lists all jobs <ctrl-z> Suspends foreground task fg %jobnumber Execute job in foreground bg %jobnumber Execute job in background stop %jobnumber Suspends background task www.scmGalaxy.com, Author - Rajesh Kumar
  • 132. Job Control Examples $ ls -R / > out 2> errfile & [1] 273 $ jobs [1] + Running ls -R / > out 2>errfile & $ fg %1 ls -R / > out 2>errfile <ctrl-z> [1] + Stopped (SIGTSTP) ls -R / >out 2>errfile & $ bg %1 % jobs [1] + Running ls -R / >out 2>errfile & $ kill %1 [1] + Terminating ls -R / >out 2>errfile & www.scmGalaxy.com, Author - Rajesh Kumar
  • 133. Module 11 Shell Programming Concepts www.scmGalaxy.com, Author - Rajesh Kumar
  • 134.
  • 135. echo & read commands echo used to display messages on the screen read used to accept values from the users, make programming interactive eg. echo “Enter ur name “ read name echo “Good Morning $name” www.scmGalaxy.com, Author - Rajesh Kumar
  • 136. Command Line Arguments Shell programs can accept values through 1. read [Interactive –used when there are more inputs] 2. From the command Line when u execute it[Non interactive- used when only a few inputs are there] For eg. sh1 20 30 Here 20 & 30 are the command Line arguments. Command Line args are stored in Positional parameters $1 contains the first argument, $2 the second, $3 the third etc. $0 contains the name of the file, $# stores the count of args $* displays all the args www.scmGalaxy.com, Author - Rajesh Kumar
  • 137. An example of Command Line args. #! /bin/bash echo “Program: $0” echo “The number of args specified is $#” echo “The args are $*” sh sh1 prog1 prog2 www.scmGalaxy.com, Author - Rajesh Kumar
  • 138. The parameter $? $? can be used to know the exit value of the previous command . This can be used in the shell scripts: www.scmGalaxy.com, Author - Rajesh Kumar
  • 139. The logical operators && and || These operators can be used to control the execution of command depending on the success/failure of the previous command eg. grep ‘director’ emp1.lst && echo “Pattern found in file” grep ‘manager’ emp2.lst || echo “pattern not found” or grep ‘director’ emp.lst’ && echo “Pattern found” || echo “Pattern not found” www.scmGalaxy.com, Author - Rajesh Kumar
  • 140. exit : Script Termination exit command used to prematurely terminate a program. It can even take args. eg. grep “$1” $2 | exit 2 echo “Pattern found – Job over” www.scmGalaxy.com, Author - Rajesh Kumar
  • 141. The if Conditiona l if condition is true then execute commands else execute commands fi else is not a must : if condition is true then execute commands fi www.scmGalaxy.com, Author - Rajesh Kumar
  • 142. An example of if eg1: if grep “director” emp.lst then echo “Pattern found” else echo “Pattern not found” fi Every if must have an accompanying then and fi , and optionally else www.scmGalaxy.com, Author - Rajesh Kumar
  • 143. Numeric comparison with test test is used to check a condition and return true or false Relational operators used by if Operator Meaning -eq Equal to -ne Not equal to -gt Greater than -ge Gfreater than or equal to -lt Less than -le Less than or equal to www.scmGalaxy.com, Author - Rajesh Kumar
  • 144. An example of test with numeric echo “Enter age” read age if test $age –ge 18 then echo “Major” else echo “Minor” fi www.scmGalaxy.com, Author - Rajesh Kumar
  • 145. [ ] short hand for test echo “Enter age” read age if [ $age –ge 18 ] then echo “Major” else echo “Minor” fi www.scmGalaxy.com, Author - Rajesh Kumar
  • 146. if –elif :Multi-way Branching if condition echo “Enter marks” then execute commands read marks elif condition if [ $marks –ge 80 ] then execute commands then echo“Distinction” elif condition elif [ $marks –ge 60 ] then execute commands then echo “First Class” else execute conditions else echo “Pass” fi fi can have as many elif , else is optional www.scmGalaxy.com, Author - Rajesh Kumar
  • 147. test String comparison test with Strings uses = and != String Tests used by test Test Exit Status -n str1 true if str1 is not a null string -z str1 true if str1 is a null string s1 = s2 true if s1 = s2 s1 != s2 true if s1 is not equal to s2 str1 true if str1 is assigned and not null www.scmGalaxy.com, Author - Rajesh Kumar
  • 148.
  • 149. The case CONDITIONAL case used to match an expression for more than one alternatives and uses a compact construct to permit multi way branching case expression in pattern1) execute commands;; pattern2) execute commands esac www.scmGalaxy.com, Author - Rajesh Kumar
  • 150. An example for case echo “1. List of files 2. Processes of user 2. Quit” echo “Enter choice” read choice case “$choice” in 1) ls ;; 2) ps –f ;; 3) exit;; *) echo “Wrong Choice” esac www.scmGalaxy.com, Author - Rajesh Kumar
  • 151. case Matching Multiple patterns echo “Do u want to continue (y/n) “ read answer case “$answer” in y|Y) echo “Good” ;; n|N) exit ;; esac case can also use wildcards like [yY][eE]* or [nN][oO] www.scmGalaxy.com, Author - Rajesh Kumar
  • 152. expr: Computation Shell doesn’t have any compute features-depend on expr expr 3 + 5 expr $x + $y expr $x - $y expr $x $y expr &x / $y expr $x % $y division gives only integers as expr can handle only integers www.scmGalaxy.com, Author - Rajesh Kumar
  • 153. Command Substitution x=5 x=`expr $x +1` echo $x it will give 6 www.scmGalaxy.com, Author - Rajesh Kumar
  • 154. sleep & wait sleep 100 the program sleeps for 100 seconds wait wait for completion of all background processes wait 138 wait for completion of the process 138 www.scmGalaxy.com, Author - Rajesh Kumar
  • 155. while loop while condition is true do execute commands done eg. x=1 while test $x -le 10 do echo $x x=`expr $x + 1` done ( while true will set infinite condition) www.scmGalaxy.com, Author - Rajesh Kumar
  • 156. until : while’s complement x=1 until test $x –gt 10 do echo $x x=`expr $x + 1` done www.scmGalaxy.com, Author - Rajesh Kumar
  • 157. For loop for variable in list do execute commands done eg. for x in 1 2 3 4 5 do echo “Value of x is $x” done www.scmGalaxy.com, Author - Rajesh Kumar
  • 158.
  • 159.
  • 160.
  • 161.

Notas do Editor

  1. www.scmGalaxy.com, Author - Rajesh Kumar www.scmGalaxy.com, Author - Rajesh Kumar