7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.

Slides:



Advertisements
Similar presentations
U NIX C OMP -145 L ECTURE 1: C ONCEPTS OF THE UNIX O PERATING S YSTEM S OURCE : S. D AS, “Y OUR U NIX : T HE ULTIMATE G UIDE ”, 2 ND E DITION, M C G RAW.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
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
Linux Linux File System.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Commands LINUX COMMANDS.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
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.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Linux+ Guide to Linux Certification, Second Edition
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
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.
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.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
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.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
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.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
UNIX Commands COMP 1090 Introduction to Unix Fall
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Linux Commands C151 Multi-User Operating Systems.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
The Unix File sytem. Introduction Tree structure …
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
EMT 2390L Lecture 3 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Learning basic Unix command It 325 operating system.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
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.
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.
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 Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Lecture 2 Working with Files and Directories
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
Shell Environments.
INTRODUCTION TO UNIX: The Shell Command Interface
(Chapter 2) John Carelli, Instructor Kutztown University
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
Module 6 Working with Files and Directories
January 26th, 2004 Class Meeting 2
Presentation transcript:

7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2

7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE2 Objectives U NIX C OMMANDS T HE P ATH F LEXIBILITY OF C OMMAND U SAGE A CCESS AND M ANIPULATE F ILES C OMMAND C LASSIFICATION U SING MAN S EVERAL SIMPLE COMMANDS

UNIX Commands WHO ( LISTS WHO IS ON SYSTEM ) DATE ( DATE AND TIME ) MAN ( MANUAL PAGE FOR THE SPECIFIED COMMAND ) INFO - LIKE MAN ORGANIZED HIERARCHICALLY PASSWD ( CHANGE PASSWD ) SCRIPT - LOGS ALL INTERACTION IN A FILE CLEAR - CLEAR SCREEN TTY - TERMINAL ID STTY - TERMINAL OPTIONS EXIT – T ERMINATE SESSION

UNIX Commands G ENERALLY, COMMANDS ARE EXECUTABLE DISK FILES (C PROGRAMS ) – Commands execute like any other program (remember chp 1) – UNIX supports commands written in any language (ie Java) – Files do not need extension – Shell (exception) automatically invoked once you log in

Types of Commands I NTERNAL COMMAND OF THE SHELL WHICH COULD BE a built-in (like cd, pwd, etc.) an alias defined by the user that invokes the disk or E XTERNAL PROGRAM ON DISK WHICH COULD BE a binary executable (written in C, C++). a script file (like a shell or perl script). internal version in a specific manner.

The PATH A shell variable (or environment variable) o Specifies a list of directories to search. Shell looks at PATH only when o Command is not used with a pathname o Also not a shell built-in. Command can still be executed if not in PATH by o Using a pathname. o Modifying PATH to include the directory containing the command. 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE6

7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE7 The PATH (Contd) PATH can be modified in an absolute or relative manner: PATH =/usr/bin:. (Absolute) PATH=$PATH:/usr/local/bin (Relative) Modified setting is lost after user has logged out unless saved in a startup file.

Flexibility of Command Usage Run multiple commands by specifying them in the same line: date ; echo $PATH Split a command into multiple lines: $ echo “Hello > Dolly” Save command output in a file: date > foo date | cut -d” “ -f2 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE8

7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE9 Flexibility of Command Usage (Cont’d) Use output of one command as input of another: date | cut -d” “ -f2 Run a command in the background with &: ls -lRa / > $HOME/ls-lRa.txt &

Access and Manipulate Files ls - List directory content mv – Move file to another location or name cp - Create a copy of the named file in the current or different directory mkdir – Create a new directory as a child of the current directory rm – Remove the named file rmdir – Remove the named directory 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE10

Command Classification: A Different Approach Utilities that are generally used in standalone mode ( vi, stty, bc ). Commands that do useful work but produce no output ( mkdir, cp, rm ). Commands that produce output which may need further processing ( date, who, ls, tty, man, info ). Commands specially designed to accept output of other commands as their input and vice versa ( grep, sort, head, prt ). 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE11

Using man Displays documentation of commands, configuration files, system calls and library functions. Organized in a number of sections. Commands are found in Section 1. May need to use section number when entry exists in multiple sections (e.g. man passwd and man -s 5 passwd ). 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE12

7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE13 Using man (Cont’d) man documentation not available for most internal commands of the shell. Use man man first to know how man should be used.

Understanding a man Page Example: wc Syntax/Synopsis wc [ -c | -m | -C ] [ -lw ] [ file... ] Most useful information available in SYNOPSIS and DESCRIPTION. When options grouped in [ ] without a |, one or more of them can be used. (-l, -w and -lw are valid.) 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE14

7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE15 Understanding a man Page The | signifies an OR condition. (e.g., Only one of -c, -m or -C can be used.) The... means that multiple occurrences of the preceding item are possible. ( wc can be used with multiple files.) EXIT STATUS indicates values returned on error.

Several simple commands Example: prt Syntax/Synopsis prt [ -c | -m | -C ] [ -lw ] [ file... ] Example: ed Syntax/Synopsis ed [ file... ] Example: ls Syntax/Synopsis ls [-OPTION] [fileName | substring] OPTION: -x= multi-column outut -F= prefix executables with *, directories with / and symbolic links -a= shows all file names beginning with. Or.. -l= show long list -d= shows only dir names See pg 66 for complete options list. 7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE16