+ All Categories
Home > Documents > Online Training in Unix Linux Shell Scripting in Hyderabad

Online Training in Unix Linux Shell Scripting in Hyderabad

Date post: 10-Jan-2016
Category:
Upload: nravi39763
View: 6 times
Download: 0 times
Share this document with a friend
Description:
Dear Student,Greetings from Etraining.guru.We provide THE BEST Shell Scripting training in the Industry by The real time expert. This course include Unix/Linux Basics, Shell Scripting and Advanced shell scripting. Our Trainer comes with an IT working experience of 10+ years in Unix Environment on a project team sizes ranging from 2 to 70+. For course content details, please refer below links:Unix Basics: http://www.etraining.guru/course/scripting/online-training-unix-linux-basicsShell Scripting: http://www.etraining.guru/course/scripting/online-training-unix-linux-shell-scriptingAdvanced Shell Scripting: http://www.etraining.guru/course/scripting/online-training-advanced-shell-scriptingIf there is any opportunity, we will be very happy to serve you. Appreciate if you can explore other training opportunities in our website as well.We can be reachable at [email protected] (or) 91-996-669-2446 for any further info/details.Regards,Karthikwww.etraining.guru"

of 48

Transcript
  • UNIX OPERATING SYSTEM

    - Ravi www.etraining.guru

  • What is an Operating System ?Definition: An Operating system (OS) is a collection of softwares that manages computer hardware resources and provides common services for computer programs. (as per Wikipedia!)A simple definition - An Operating System is an interface between Hardware and User.Circular ViewHorizontal View

  • Examples of Operating SystemsDOS - Disk Operating System, a product of IBM. Not very user friendly!Windows - A product of Microsoft. User friendliness through GUIMacOS - Macintosh, a product of Apple. User friendliness through GUIUnix - Originally CUI, now has GUI as wellLinux - Supports both CUI & GUI If Windows is an OS, what are Windows 95, 98, ME, NT, 2000, XP, 7, and 8?Similarly, Unix and Linux OSs have various flavors/versions too. Lets first look at Unix Evolution

  • Unix EvolutionMULTIcs (MULTIplexed Information and Computing Service)UNIXBy, Dennis Ritchie, Brain kernighan and Ken Thompson @AT&T Bell Laboratories in early 1970's

  • Unix Evolution Is the name of the family of operating systems developed at Bell Laboratories around 1969.

    Was largely the creation of two programmers working at Bell Laboratories, Ken Thompson and Brain Kernighan.

    Was initially used in academic environments and spread quickly to commercial environments also

    Has got 90% of it developed in C language and, 10% machine specific assembly code.

    Basic UNIX system occupies around 10 MB disk space on PCs.

  • Unix Evolution Note: You can also call these Single Unix Specifications as POSIX - Portable Operating System Interface for UNIX

  • Unix Evolution Open source (vs) Closed Source (vs) Mixed source?

  • Unix Evolution

  • Unix Evolution

  • What is LINUX?Linux is a Unix clone written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX compliance.Below are few popular Linux distributions:

    Debian - A non-commercial distribution maintained by a volunteer developer community with a strong commitment to free s/w principles

    Ubuntu - A popular desktop and server distribution derived from Debian

    Fedora - A community distribution sponsored by American company Red Hat

    openSUSE - A community distribution mainly sponsored by American company Novell

    Mageia, Mint Linux, slackware, etc

  • Unix/Linux Main Features Multitasking CapabilitiesMulti-User CapabilitiesHierarchical Directory StructureSecurityPortability

  • UNIX ArchitectureKernelShellTools & ApplicationsH/W

  • UNIX Architecture Categorized as three levels:

    Kernel - Core/Heart of the Operating System

    Shell - User interface with Operating System

    Tools and Applications - Utilities and User ProgramsNote: In detail, will be covered in later sections

  • Dumb Terminals / NodesUNIX Server < --- > Terminals

  • Working in Unix Environment

  • Few things to remember Working in Unix is majorly through commands Syntax: command option(s) filename(s)You must type spaces between commands, options, and filenamesUnix is case sensitiveUnix has a lot of commands! Dont try to byheart all of them

  • unameCommand Name: unameSyntax: uname [option] Description: Print system informationUsage: uname -a ==> Print all informationuname -s ==> Kernal nameuname -n ==> node nameuname -r ==> Kernal releaseuname -o ==> operating systemuname -son ==> Kernal name + os + node nameuname -m==> m/c hardware nameuname -i ==> Hardware platform

  • manCommand Name: manSyntax: man [command]Description: Online manual pages; In built google!Usage: man uname ==> to display uname manual pagesman man ==> to display man manual pagesNote: In manual pages, q is to quit/come back to command prompt. Space Bar is to scroll to next page

  • User Related who Shows who is logged on w Shows who is logged on and what they are doing whoami Effective userid who am i details about the userid

    PS: man k who searches for word who in all man pages

  • Unix MISC commands tty Displays the terminal id stty aExample: stty intr ^a (To use CTRL + a for interrupt) ifconfig To get IP addressExample: /sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}

  • Unix MISC Commands cal banner clear alias

  • Date Command Gets/sets the date and time in the UNIX server machine Some Options : %D, %T, %A, %B, %H, %d Examples -$ date-$ date +%D-$ date +%T-$ date +%d-%m-%Y

  • Date command contd Setting system time: (Needs root permission)Example: $date MMDDhhmmYYYY.ssWhere, MM month DD day YYYY year hh hour is based on 24 hour mm minutes ss seconds

  • Before we move on to next concept unamemanwhowwhoamiwho am ittyifconfigcalbannerstty dateclearalias

  • UNIX FILE SYSTEM

  • What is a filesystem?A filesystem is a logical collection of files on a partition or disk. You can view filesystems using df (or) bdf commandsUnix uses a hierarchical file system structure, much like an upside-down tree, with root (/) at the base of the file system and all other directories spreading from there.In Unix everything is a file - a stream of bytes. Unix treats documents, directories, hard-drives, CD-Roms, modems, keyboards, printers, monitors, terminals, etc as files.For each file in the filesystem, UNIX stores administrative information in a structure known as Inode (Index node).

    ls -I /etc/passwdstat /etc/passwd

  • Unix File system (tree) Structure

  • UNIX File System3 types of files

    Ordinary - Under user control (Ex: Notepad/wordpad in windows)

    Directory - to hold list of files (like a folder in windows)

    Speical - For example, device drivers, raw devices, etc

  • File System Commands pwdPrint Working Directory ls cd mkdir touch

  • ls List directory contents Syntax: ls [OPTIONS] [FILE(s)] Examples: ls lLong Listing ls lato list hidden files ls ltrTo list files based upon modified time ls l /home/cdctrg32/ravi/copyme (listing other user files)Note: . is Current working directory, .. is Parent working directory

  • cd Change Directory syntax: cd [options] [directory] Example: To go to root directory, cd / cd .(You will be in pwd)cd ..(One directory up) cd - (Changes to previous working directory) cd Enter (Changes to Home directory)

  • mkdir create directories Syntax: mkdir [OPTIONS] [Directories] Example: cd Enter (You will be placed in your home directory) mkdir training (Creates a new training directory) ls l training (View recently created directory) cd training (Now you will be placed in training directory) pwd; ls (Bingo!!! No files created yet)

  • cp copy files and directories Syntax: cp [OPTIONS] [SOURCE] [DEST] Example: cd training; cp /home/cdctrg32/ravi/copyme mycopy (file copy)cp R /home/cdctrg32/ravi/copy_dir . (directory copy)

  • mv move/rename files Syntax: mv [OPTIONS] SOURCE DEST Example: cd trainingmv mycopy mvcopy

  • ln links b/w files Syntax: ln [OPTION] target dest Example: cd trainingln /home/cdctrg32/ravi/linkme linkme ls l linkme -rw-rw-r-- 2 cdctrg32 cdctrg32 49 Jul 21 22:49 linkmeNote: type cat linkme. The usage of cat will be covered in later sessions

  • File Permissions ls l filename will display as below:-rw-rw-r-- 1 cdctrg32 cdctrg32 17 Jul 21 22:55 filenameField 1: a set of ten permission flags. Field 2: link count (don't worry about this) Field 3: owner of the file Field 4: associated group for the file Field 5: size in bytes Field 6-8: date of last modification (format varies, but always 3 fields) Field 9: name of file

  • Field 1: Contains 10 characters1 - directory flag, 'd' if a directory, '-' if a normal file, something else occasionally may appear here for special devices. 2,3,4 - read, write, execute permission for User (Owner) of file 5,6,7 - read, write, execute permission for Group 8,9,10 - read, write, execute permission for Other

  • Permissions are set according to numbers. Read is 4. Write is 2. Execute is 1. The sums of these numbers give combinations of these permissions:

    0 = no permissions whatsoever; this person cannot read, write, orexecute the file 1 = execute only 2 = write only 3 = write and execute (1+2) 4 = read only 5 = read and execute (4+1) 6 = read and write (4+2) 7 = read and write and execute (4+2+1)

  • The below file has 664 permissions-rw-rw-r-- 1 cdctrg32 cdctrg32 17 Jul 21 22:55 filename To give write permission to other group users,chmod 666 filename To take out permission from all other users: chmod 600 filename Note: id command tells the default group id

  • Example: Can you cat the below file to see the contents of the filecat /home/cdctrg32/ravi/passwords Nope. But why?

  • chgrp & chown chgrp NewGroupName File/Directoryname chown Newownername File/Directoryname

  • touch creates empty file changes the file timestamp Example: touch filename

    Note: touch command is mostly used in system build time. But how?

  • umask User file creation mode mask 4 digit octal number that unix uses to determine the file permission for newly created files (666 umask) value is the default permissions Exercise: Change the umask value to 000 and create a new file.

  • more less head - tail cp /home/cdctrg32/ravi/largefile .; cat largefile (Bingo!!!) more Forward only less - forward and backward movement head -10 largefile /* First 10 lines of the file */ tail -10 largefile /* Last 10 lines of the file */ **To view Log Files**

  • which Displays the path of the commands whereis - More info than which whatis - quick introduction about the command ldd prints library dependenciesExample: ldd /bin/ls file - displays the file type

  • history command history displays the history of typed commandsUsage: history 20!! Repeats the last command!number -> reruns the command given at the given line passwd To change your password

  • *Ravikumar NandigamCircular View*Similarly, Unix and Linux have various flavors/versions too. Lets first look at Unix Evolution *Dennis Ritchie and Ken Thompson @AT&T Bell Laboratories in early 1970's*Note: You can also call these Single Unix Specifications as POSIX - Portable Operating System Interface for UNIX*Open Source (vs) Closed Source (vs) Mixed Source*Below are popular Linux distributions:***Unix is a command based operating system*Command Name: uname*q is to quit/come back to command prompt. Tab is to scroll to next page*Unix uses a hierarchical file system structure, much like an upside-down tree, with root (/) at the base of the file system and all other directories spreading from there.*Unix Tree Structure*


Recommended