Unix Tutorial - Department Of Physics And Astronomy

1y ago
22 Views
2 Downloads
3.17 MB
152 Pages
Last View : 2d ago
Last Download : 3m ago
Upload by : Raelyn Goode
Transcription

Unix Tutorial

UNIX TUTORIALSimply Easy Learning by tutorialspoint.comtutorialspoint.comi

ABOUT THE TUTORIALUnix TutorialUNIX is a computer Operating System which is capable of handling activities from multiple users at thesame time.Unix was originated around in 1969 at AT&T Bell Labs by Ken Thompson and Dennis Ritchie. This tutorialgives a very good understanding on Unix.AudienceThis tutorial has been prepared for the beginners to help them understand them basic to advancedconcepts covering Unix commands, UNIX shell scripting and various utilities.PrerequisitesWe assume you have little knowledge about Operating System and its functionalities. A basicunderstanding on various computer concepts will also help you in understanding various exercises givenin this tutorial.Copyright & Disclaimer Notice Allthe content and graphics on this tutorial are the property of tutorialspoint.com. Any content fromtutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or formwithout the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws.This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding theaccuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com siteor this tutorial content contains some errors, please contact us at webmaster@tutorialspoint.comTUTORIALS POINTSimply Easy Learning

Table of ContentUnix Tutorial . 2Audience . 2Prerequisites . 2Copyright & Disclaimer Notice. 2Unix Getting Started . 11What is Unix ? . 11Unix Architecture: . 11System Bootup: . 12Login Unix: . 13To log in: . 13Change Password: . 13Listing Directories and Files: . 14Who Are You? . 14Who is Logged In? . 14Logging Out:. 15To log out: . 15System Shutdown: . 15Unix File Management . 16Listing Files: . 16Meta Characters: . 17Hidden Files: . 18Creating Files: . 18Editing Files:. 19Display Content of a File: . 19Counting Words in a File: . 19Copying Files: . 20Renaming Files: . 20Deleting Files: . 20Standard Unix Streams: . 20Unix Directories. 22Home Directory: . 22Absolute/Relative Pathnames: . 22Listing Directories: . 23Creating Directories:. 23Creating Parent Directories: . 24Removing Directories: . 24Changing Directories: . 24TUTORIALS POINTSimply Easy Learning

Renaming Directories: . 25The directories . (dot) and . (dot dot) . 25Unix File Permission Setup . 26The Permission Indicators: . 26File Access Modes: . 261. Read:. 262. Write: . 273. Execute: . 27Directory Access Modes:. 271. Read:. 272. Write: . 273. Execute: . 27Changing Permissions: . 27Using chmod in Symbolic Mode: . 27Using chmod with Absolute Permissions:. 28Changing Owners and Groups: . 28Changing Ownership: . 29Changing Group Ownership: . 29SUID and SGID File Permission: . 29Unix Environment . 31The .profile File: . 32Setting the Terminal Type: . 32Setting the PATH: . 32PS1 and PS2 Variables: . 33Environment Variables: . 34Java Basic Utilities . 36Printing Files: . 36The pr Command: . 36The lp and lpr Commands: . 37The lpstat and lpq Commands: . 37The cancel and lprm Commands: . 38Sending Email: . 38Unix Pipes and Filters . 40The grep Command: . 40The sort Command: . 41The pg and more Commands:. 42Unix Processes Management . 43Starting a Process: . 43Foreground Processes: . 43TUTORIALS POINTSimply Easy Learning

Background Processes: . 44Listing Running Processes: . 44Stopping Processes: . 45Parent and Child Processes: . 46Zombie and Orphan Processes: . 46Daemon Processes: . 46The top Command: . 46Job ID Versus Process ID: . 46Unix Communication . 48The ping Utility: . 48Syntax: . 48Example: . 48The ftp Utility: . 49Syntax: . 49Example: . 50The telnet Utility: . 51The finger Utility: . 51Unix – The vi Editor . 53Starting the vi Editor: . 53Operation Modes: . 54Getting Out of vi: . 54Moving within a File: . 54Control Commands: . 55Editing Files:. 56Deleting Characters: . 56Change Commands: . 57Copy and Past Commands: . 57Advanced Commands: . 57Word and Character Searching: . 58Set Commands: . 59Running Commands:. 59Replacing Text: . 59IMPORTANT: . 60Unix- What is Shell. 61Shell Prompt:. 61Shell Types: . 61Shell Scripts: . 62Example Script: . 62Shell Comments: . 62TUTORIALS POINTSimply Easy Learning

Extended Shell Scripts: . 63Unix- Using Variables. 64Variable Names: . 64Defining Variables: . 64Accessing Values: . 65Read-only Variables: . 65Unsetting Variables: . 65Variable Types: . 66Unix-Special Variables . 67Command-Line Arguments: . 68Special Parameters * and @: . 68Exit Status: . 69Unix – Using Arrays . 70Defining Array Values:. 70Accessing Array Values: . 71Unix - Basic Operators . 72Arithmetic Operators: . 73Relational Operators: . 74Boolean Operators: . 76Example: . 76String Operators: . 77Example: . 78File Test Operators: . 79Example: . 80C Shell Operators: . 81Arithmatic and Logical Operators: . 81File Test Operators: . 82Korn Shell Operators: . 83Arithmatic and Logical Operators: . 83File Test Operators: . 83Unix – Decision Making. 85The if.else statements: . 85if.fi statement . 85Syntax: . 85Example: . 86if.else.fi statement . 86Syntax: . 86Example: . 86if.elif.else.fi statement . 87TUTORIALS POINTSimply Easy Learning

Syntax: . 87Example: . 87The case.esac Statement:. 87case.esac statement . 88Syntax: . 88Example: . 88Unix – Shell Loops . 90The while loop . 90Syntax: . 90Example: . 90The for loop . 91Syntax: . 91Example: . 91The until loop. 92Syntax: . 92Example: . 92The select loop . 93Syntax: . 93Example: . 93Nesting Loops: . 94Nesting while Loops: . 94Syntax: . 94Example: . 95Unix – Loop Control . 96The infinite Loop: . 96Example: . 96The break statement: . 96Syntax: . 97Example: . 97The continue statement: . 98Syntax: . 98Example: . 98Unix – Shell Substitutions . 99What is Substitution? . 99Example: . 99Command Substitution: . 100Syntax: . 100Example: . 100Variable Substitution: . 100TUTORIALS POINTSimply Easy Learning

Example: . 101Unix – Quoting Mechanisms . 102The Metacharacters . 102Example: . 102The Single Quotes: . 103The Double Quotes: . 104The Back Quotes: . 104Syntax: . 104Example: . 105Example: . 105Unix – IO Redirections . 106Output Redirection: . 106Input Redirection: . 107Here Document: . 107Discard the output: . 108Redirection Commands: . 109Unix – Shell Functions . 110Creating Functions: . 110Example: . 110Pass Parameters to a Function: . 111Returning Values from Functions: . 111Example: . 111Nested Functions: . 112Function Call from Prompt:. 112Unix - Manpage Help . 114Syntax: . 114Example: . 114Man Page Sections: . 114Useful Shell Commands: . 115Unix - Regular Expressions . 116Invoking sed: . 116The sed General Syntax:. 116Deleting All Lines with sed: . 117The sed Addresses: . 117The sed Address Ranges: . 117The Substitution Command: . 118Substitution Flags: . 119Using an Alternative String Separator: . 119Replacing with Empty Space: . 119TUTORIALS POINTSimply Easy Learning

Address Substitution: . 119The Matching Command: . 120Using Regular Expression: . 120Matching Characters: . 121Character Class Keywords: . 122Aampersand Referencing:. 122Using Multiple sed Commands: . 123Back References: . 123Unix – File System Basics . 125Directory Structure: . 125Navigating the File System:. 126The df Command: . 127The du Command: . 127Mounting the File System: . 128Unmounting the File System: . 128User and Group Quotas: . 128Unix – User Administration . 130Managing Users and Groups: . 130Create a Group . 131Modify a Group: . 131Delete a Group: . 131Create an Account . 132Modify an Account: . 132Delete an Account: . 133Unix – System Performance . 134Peformance Components:. 134Peformance Tools: . 135Unix – System Logging . 136Syslog Facilities: . 136Syslog Priorities: . 137The /etc/syslog.conf file: . 138Logging Actions: . 138The logger Command:. 139Log Rotation: . 139Important Log Locations . 139Unix – Signals and Traps . 140List of Signals: . 140Default Actions: . 141Sending Signals: . 141TUTORIALS POINTSimply Easy Learning

Trapping Signals: . 141Cleaning Up Temporary Files: . 142Ignoring Signals: . 142Resetting Traps: . 143Unix – Useful Commands . 144Files and Directories:.

All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws.

Related Documents:

Unix 101: Introduction to UNIX (i.e. Unix for Windows Users) Mark Kegel September 7, 2005 1 Introduction to UNIX (i.e. Unix for Windows Users) The cold hard truth · this course is NOT sponsored by the CS dept. · you will not receive any credit at all introduce ourselv

ABOUT THE TUTORIAL Unix Tutorial UNIX is a computer Operating System which is capable of handling activities from multiple users at the same time. Unix was originated around in 1969 at AT&T Bell Labs by Ken Thompson and Dennis Ritchie. This tutorial gives a very good understanding on Unix. Audience

UNIX and POSIX APIs: The POSIX APIs, The UNIX and POSIX Development Environment, API Common Characteristics. UNIT – 2 6 Hours UNIX Files: File Types, The UNIX and POSIX File System, The UNIX and POSIX File Attributes, Inodes in UNIX

Physics 20 General College Physics (PHYS 104). Camosun College Physics 20 General Elementary Physics (PHYS 20). Medicine Hat College Physics 20 Physics (ASP 114). NAIT Physics 20 Radiology (Z-HO9 A408). Red River College Physics 20 Physics (PHYS 184). Saskatchewan Polytechnic (SIAST) Physics 20 Physics (PHYS 184). Physics (PHYS 182).

Unix was originally developed in 1969 by a group of AT&T employees Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna at Bell Labs. There are various Unix variants available in the market. Solaris Unix, AIX, HP Unix and BSD are a few examples. Linux is also a flavor of Unix which is freely available.

This is a standard UNIX command interview question asked by everybody and I guess everybody knows its answer as well. By using nslookup command in UNIX, you can read more about Convert IP Address to hostname in Unix here. I hope this UNIX command interview questions and answers would be useful for quick glance before going for any UNIX or Java job interview.

UNIX Files: File Types, The UNIX and POSIX File System, The UNIX and POSIX File Attributes, Inodes in UNIX System V, Application Program Interface to Files, UNIX Kernel Support for Files, Relationship of C Stream Pointers and File Descriptors, Directory Files, Hard and Symbolic Links. UNIT – 3 7 Hours

UNIX operating system, we will try to place our observations in a wider context thanjustthe UNIXsystem or one particular version of the UNIX system. UNIX system security is neither better nor worse than that of other systems. Any system that provides the same facilities as the UNIX system will necessarily have similar hazards.