UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

Lab6 CPCS361 I.Mona Alshehri. Working with Files and Directories Creating files Create a file with the cat command type the command cat > name_of_file.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
CMPE 151: Network Administration Spring Class Description Focus: system and network administration. Sequence of exercises. E.g., installing/configuring.
Introduction to Linux and Shell Scripting Jacob Chan.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
LIN Unix Lecture 3 Hana Filip. LIN UNIX Resources UNIX Tutorials UNIX help for.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification Chapter Four Exploring Linux Filesystems.
Linux+ Guide to Linux Certification, Third Edition
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Lecture 24CS311 – Operating Systems 1 1 CS311 – Lecture 24 Outline Final Exam Study Guide Note: These lecture notes are not intended replace your notes.
40 Years and Still Rocking the Terminal!
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Basic of UNIX For fresh members of SPARCS
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
Why UNIX? In the 1980s, UNIX became popular In the 1980s, UNIX became popular Customer demand for open systems: Customer demand for open systems: Application.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Tutorial of Unix Command & shell scriptS 5027
Chapter 11 Command-Line Master Class
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Linux file system "On a UNIX system, everything is a file;
Some Linux Commands.
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Tutorial of Unix Command & shell scriptS 5027
Introduction to Linux Week 0 - Thursday.
Tutorial of Unix Command & shell scriptS 5027
UNIX Reference Sheets CSE 2031 Fall 2010.
Tutorial Unix Command & Makefile CIS 5027
Linux Shell Script Programming
A shell is a user interface.
LPI Linux Certification
Presentation transcript:

UNIX An Introduction

Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering System II in early 80s AT&T began offering System II in early 80s Linux Linux defined in 1991 defined in 1991 Red Hat, 1995 Red Hat,

UNIX Philosophy Simplicity Simplicity Reusability Reusability Filters Filters Open Formats Open Formats Flexibility Flexibility

What is the shell? Utility program loaded when a user logs in init getty login sh (bash) startup

Shell’s Responsibilities Shell Program Execution variable and filename substitution I/O Redirection pipeline hookup environment control interpreted programming languages

Shell Substitutions Certain characters are interpreted by the various Unix shells as “wildcards” for filenames, also known as metacharacters Certain characters are interpreted by the various Unix shells as “wildcards” for filenames, also known as metacharacters * - matches 0 or more of any characters ls *.c ? - matches any single character ls file0?.c [...] - matches any single character if it is in the list provided ls file[0-9].c

Regular Expressions A formalized way to specify strings A formalized way to specify strings File names (shell commands) File names (shell commands) Strings in text files (during editing) Strings in text files (during editing) Compilers (future topic) Compilers (future topic) Sed Sed Unfortunately, each use defines its own special metacharacters Unfortunately, each use defines its own special metacharacters

Regular Expressions LS – which files match A*[0-9]?.c LS – which files match A*[0-9]?.c AboutTime.c AboutTime.c AboutTime AboutTime A2.c A2.c A2i.c A2i.c A211x.c A211x.c AllFilesGreaterThan12.c AllFilesGreaterThan12.c A2char.c A2char.c

Regular Expressions Write a regular expressions for: Write a regular expressions for: All files with an ‘X’ in the name All files with an ‘X’ in the name All files with an ‘X’ and a following ‘Y’ All files with an ‘X’ and a following ‘Y’ All file names with exactly 6 characters All file names with exactly 6 characters All file names with more than 6 characters All file names with more than 6 characters All files that start with ‘a’ and end with ‘x’ All files that start with ‘a’ and end with ‘x’ All files names including an ‘a’ but fewer than 10 characters (this one is TOUGH!) All files names including an ‘a’ but fewer than 10 characters (this one is TOUGH!)

The Manual The man command The man command man gcc man gcc Spacebar for next page and return for next line Spacebar for next page and return for next line q to quit q to quit Also try info Also try info info gcc info gcc

Linux Commands File manipulation File manipulation rm, mv, cat, cp, chmod rm, mv, cat, cp, chmod Navigation Navigation cd, pushd, popd cd, pushd, popd System information System information ls, wc, top, ps ls, wc, top, ps

File Manipulation vi (or your editor of choice) vi (or your editor of choice) touch touch mkdir, rmdir mkdir, rmdir cp, rm cp, rm chmod, chown chmod, chown Permissions Permissions read, write, execute; owner, group, user read, write, execute; owner, group, user -rw-r--r-- = 644 -rw-r--r-- = 644

File Information ls ls more more wc wc cat cat head head tail tail du du df df

File System Directory Structure is a tree Directory Structure is a tree All items in hierarchy are files All items in hierarchy are files Files represented by inode – ls –I Files represented by inode – ls –I Multiple “files” (names) to an inode Multiple “files” (names) to an inode

Example File Tree / /home /dev /usr /home/akl /home/sweany public classes 3600

Moving between locations The cd command changes directory The cd command changes directory cd cd cd pathname cd pathname pushd pathname pushd pathname popd pathname popd pathname

Pathnames Two ways to specify : Two ways to specify : Absolute pathnames start with a slash (/). Absolute pathnames start with a slash (/). Relative pathnames don’t. Relative pathnames don’t. Example absolute pathnames : Example absolute pathnames : /home/s3/Empdata/dbs /home/s3/Empdata/dbs /etc/passwd /etc/passwd Example relative pathnames Example relative pathnames programs/tsp.c programs/tsp.c /../programs/tsp.c../../programs/tsp.c ~

File Permissions File Permissions chmod mode filename(s) chmod mode filename(s) umask – specifies default file permissions umask – specifies default file permissions ls –l displays detailed file information ls –l displays detailed file information $ ls -l -rwxr-xr-x 1 s3 students 892 Feb 8 10:15 memo drwxrwxrwx 1 s3 students 1024 Dec 10 8:05 progs

Special Files Dot files – filename starts with ‘.’ Dot files – filename starts with ‘.’ ls -a ls -a.bash_history.bash_history.bash_login.bash_login.profile – MAY not be writeable by user.profile – MAY not be writeable by user

My.profile alias rm’/bin/rm’ PATH=.:/usr/local/bin:/usr/bin:/home/sweany/bin

sort Command sort format: sort format: sort [options] filename sort [options] filename Options: Options: -dalphabetic, ignore punctuation -dalphabetic, ignore punctuation -fignore case for sorting -fignore case for sorting -rreverse sort order -rreverse sort order -o outfile output to file, not stdout -o outfile output to file, not stdout -narithmetic order -narithmetic order -tcuse ‘c’ to separate fields; default is whitespace -tcuse ‘c’ to separate fields; default is whitespace

grep Commands grep, egrep, fgrep grep, egrep, fgrep grep format: grep format: grep [options] search_string filename(s) grep [options] search_string filename(s) Options: Options: -cPrints the count of matching lines rather than the actual lines -cPrints the count of matching lines rather than the actual lines -lprints the name of each file containing matching lines, rather than the actual lines -lprints the name of each file containing matching lines, rather than the actual lines -nprecedes each line with a line number -nprecedes each line with a line number -vinverse search, shows all lines that do not match pattern -vinverse search, shows all lines that do not match pattern

find Command find format: find format: find directory_name search_criteria action find directory_name search_criteria action Search Criteria: Search Criteria: name filenamefiles that match filename name filenamefiles that match filename atime +-nfiles last accessed in days atime +-nfiles last accessed in days mtime +-nfiles last modified in days mtime +-nfiles last modified in days followfollow symbolic links followfollow symbolic links

find Command Actions: Actions: -printprint the files found -exec cmdexecute command on files found -ok cmdlike exec, but prompts to execute command first

Find Examples ix% find programs –name “*.c” –print ix% find. -name “*.c” –exec rm –rf {} \; ix% find. -mtime -3 -print

Type Conversion doubleatof (char *nptr) longatol (char *str) intatoi (char *str)