Introduction to Computer Organization & Systems Topics: Intro to UNIX COMP 21000 John Barr.

Slides:



Advertisements
Similar presentations
Introduction to UNIX CSE 2031 Fall May 2015.
Advertisements

Lecture 2 Shell environment I: - command line interface & basic commands; - directories & files; - standard I/O & file descriptors; CSE4251 The Unix Programming.
Unix. Outline Commands Environment Variables Basic Commands CommandMeaning lslist files and directories ls -alist all files and directories mkdirmake.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
CS4315A. Berrached::CMS::UHD1 Quick UNIX Tutorial.
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
Very Quick & Basic Unix Steven Newhouse Unix is user-friendly. It's just very selective about who its friends are.
Introduction to Linux/UNIX. History UNIX beginnings in 1969 (Linus Torvalds is born!) AT & T Bell Laboratories (Ken Thompson & Dennis Richie) Working.
July 10, 2003Serguei A. Mokhov, 1 UNIX Commands COMP 444/5201 Revision 1.4 January 25, 2005.
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.
Systems Programming Concepts
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
3 File Processing Mauro Jaskelioff. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash.
Introduction to UNIX Don Bahls user consultant (907)
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Unix Basics Chapter 4.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
2INC0 Operating Systems Introduction to Linux
Shells. A program that is an interface between a user at a terminal and the computers resouces ▫The terminal may be real or an emulator The shell is.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
UNIX/LINUX Shells Shell is an UNIX/LINUX command interpreter. Shell command can be internal or external. The code to execute an internal command is part.
Linux+ Guide to Linux Certification, Third Edition
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
1 Week 2 The Crunchy Shell to the Soft and Chewy Kernel… Sarah Diesburg 8/3/2010 COP4610 / CGS5765.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Chapter 0 A “Quick-Start” into the UNIX Operating System.
Lesson 2 1.Commands 2.Filename Substitution 3.I/O Redirection 4.Command Grouping 5.Shell Responisibilites Review of the Basics.
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.
Introduction to UNIX Road Map: 1. UNIX Structure 2. Components of UNIX 3. Process Structure 4. Shell & Utility Programs 5. Using Files & Directories 6.
L&T Infotech1 UNIX – Getting Started - Aneesh Ramani.
Linux Essentials Programming and Data Structures Lab M Tech CS – I 2014 Arijit Bishnu Ansuman Banerjee Debapriyo Majumdar.
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.
UNIX Commands COMP 1090 Introduction to Unix Fall
UNIX shell environments CS 2204 Class meeting 6 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
UNIX shell environments CS 2204 Class meeting 4 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Introduction to Programming Using C An Introduction to Operating Systems.
A gentle introduction to LINUX at the command prompt.
Jozef Goetz, expanded by Jozef Goetz, 2006 Credits: Parts of the slides are based on slides created by textbook authors, Syed M. Sarwar, Robert.
Linux+ Guide to Linux Certification, Second Edition
Introduction to Bash Shell. What is Shell? The shell is a command interpreter. It is the layer between the operating system kernel and the user.
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.
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
Learning Unix/Linux Based on slides from: Eric Bishop.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Using Linux Kaya Oğuz Room: 310.
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.
A “Quick-Start” into the UNIX Operating System
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
CSE 303 Concepts and Tools for Software Development
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
CS 60 Discussion Review.
Unix : Introduction and Commands
Tutorial of Unix Command & shell scriptS 5027
Introduction to Linux/UNIX
Introduction to Computer Organization & Systems
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Presentation transcript:

Introduction to Computer Organization & Systems Topics: Intro to UNIX COMP John Barr

Operating System How do we interact with our computer? 2-2

Operating System What about multiple programs? multiple users? 2-3

Operating System The reality? The OS intervenes The OS controls the hardware – software must talk to the OS via System calls 2-4 Kernel

Operating System What about logging in? How does software talk to multiple things? 2-5 Shell

Operating System What about multiple input streams? What about networks? 2-6

Operating System What is systems programming? – writing programs to talk to the OS – using system calls, functions that talk to the OS – often more tricky and dangerous than library calls like printf 2-7 System Calls System Call examples: open() write() read() fork() System Call examples: open() write() read() fork()

Unix Accounts – Changing passwords, finding out about people passwd whoami or who finger accountName Help – about a command man cmdName apropos cmdName or man –k cmdName which cmdName ;gives path to the application 2-8

Unix Processes – What’s running? ps ;only your processes ps –a ;all processes PID TTY TIME CMD ttys000 0: bash ttys000 0:00.00 man builtin ttys000 0:00.00 /usr/bin/less -is ttys001 0: bash ttys002 0:00.02 –bash kill -9 pid ;kill process pid ^c ;hold down control key and press the c key ;kills currently running process 2-9

Unix Directories – Seeing, manuvering, creating cd /path/to/new/directory pwd ls [-a –l] Mkdir dirName rmdir dirName rm –r dirName pushd. popd 2-10

Unix Files – Moving, deleting cp src dest rm fileName – Viewing more fileName cat fileName1 fileName2 2-11

Unix Files – Permissions ls –l A228536:~ barr$ ls -l total barr CAMPUS\Domain Users 1870 Mar Admin at IC drwxr-xr-x 3 barr CAMPUS\Domain Users 102 Jun Applications d rwx rwx rwx Directory user group other r = read w = write x = execute chmod o+r fileName chmod g-w fileName chmod u+x *.c ; can use wild card charcter 2-12

More Unix Configuration files –.exrc and.vimrc files put in your home directory Can put set commands in this file These commands will be executed every time you start vi (.exrc) or vim (.vimrc) 2-13

More Unix Shells – Environmental variables (capitalization counts!) $ENV $PATH #the search path used by UNIX when you #use a command to see all environmental variables enter: > env 2-14

More Unix –.bashrc and.bash_profile files alias # creates aliases for commands – alias la='ls -A’ –# now when you type la the command ls –A is executed changing $PATH –export PATH=$PATH:$HOME:. –#this adds your home directory #and the current directory (e.g., ‘.’) to the search #path –Do NOT put spaces before or after the = When you change.bashrc, use source to act on the changes –source.bashrc 2-15

More Unix.bashrc vs.bash_profile files It's explained in man bash: Login shells are the ones that are read once you login (so, they are not executed when merely starting up xterm, for example). There are other ways to login. For example using an X display manager. Those have other ways to read and export environment variables at login time /bin/bash The bash executable /etc/profile The systemwide initialization file, executed for login shells ~/.bash_profile The personal initialization file, executed for login shells ~/.bashrc The individual per-interactive-shell startup file ~/.bash_logout The individual login shell cleanup file, executed when a login shell exits ~/.inputrc Individual readline initialization file

More Unix Pipes – using the | operator to connect programs –gcc myfile.c | more Redirection – using > and >> to redirect stdout to a file > to overwrite >> to append – using &> to redirect stderr to a file gcc –g -o ex1 ex1.c &> err.txt – using < to redirect stdin from file 2-17

More Unix History –history ;shows past commands 1170 la 1171 vi.exrc 1172 popd 1173 ls 1174 vi helloworld.c 1175 vim helloworld.c 1176 history – the ! Operator !1170 ; this will run the comand “la” 2-18

grep grep is a command that searches through files for a pattern and prints lines that contain that pattern for example, the following command will search for the string “int” in all files that end in “.c” and print out the lines with that string: grep int *.c could give the result: prob2.c:int main(int arc, char *argv[]) prob2.c: int x; prob3.c:int main(int arc, char *argv[]) prob3.c: int y, z; 2-19