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.

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

1 Introduction to UNIX Ke Liu
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
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Guide To UNIX Using Linux Third Edition
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.
2 $ command Command Line Options ls –a –l hello hi Command Arguments.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Linux Commands LINUX COMMANDS.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
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.
Guide To UNIX Using Linux Fourth Edition
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
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/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.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #4  Unix software architecture  Correcting mistakes  System setups  Useful commands for the beginner.
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.
Chapter 0 A “Quick-Start” into the UNIX Operating System.
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Contents Why an Operating System (OS) How.
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.
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.
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.
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.
UNIX Commands COMP 1090 Introduction to Unix Fall
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Λειτουργικά Συστήματα - Lab1 Γιάννης Πετράκης. The Operating System  Unix is a layered operating system  The innermost layer is the hardware that provides.
Introduction to Programming Using C An Introduction to Operating Systems.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
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 Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
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.
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.
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 101 Training Module Linux Basics.
Andy Wang Object Oriented Programming in C++ COP 3330
Lecture 2 Working with Files and Directories
Some Linux Commands.
Shell Environments.
INTRODUCTION TO UNIX: The Shell Command Interface
(Chapter 2) John Carelli, Instructor Kutztown University
Unix : Introduction and Commands
Andy Wang Object Oriented Programming in C++ COP 3330
January 26th, 2004 Class Meeting 2
Presentation transcript:

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 times ( at and cron ). User input can also be provided through command line arguments. Command arguments need not be known in advance. Allows designing of applications that determine their own behavior by reading configuration files.

Structure of a Command e.g. ls -l -u -t chap01 Command filenames need no specific extensions. A command’s behavior is determined by its arguments and options. Command and arguments must be separated by whitespace. Generally possible to combine multiple options into a single one ( ls -l -u -t same as ls -lut ) Order of combining usually not important ( ls -lut same as ls -utl )

Types of Commands External program on disk which could be: a binary executable (written in C, C++, …). a script file (like a shell or perl script). an alias defined by the user that invokes the disk command Internal builtin command of the shell (e.g. cd, pwd ) The commands which, whereis, and type tell you what’s being run.

How the Shell Determines the Command to Run If command is invoked with a pathname (like /bin/echo), the shell runs program at the specified location. If command is invoked without a pathname, the shell first checks whether it is an alias or builtin: If alias or builtin, the shell runs it without looking in disk. If not, the shell looks at the PATH variable for directories where the command may reside.

The PATH PATH is a shell variable (or environment variable) that specifies a list of directories to search. e.g. PATH=/bin:/usr/bin:. Shell looks at PATH only when command is not used with a pathname and is also not a shell builtin. Command can still be executed if not in PATH by Using a pathname Modifying PATH to include the directory containing the command. PATH can be modified in an absolute or relative manner: PATH=/usr/bin:. (Absolute) PATH=mybin:/usr/local/bin (Relative)

Flexibility of Command Usage in UNIX 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 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 &

Using the man Command Displays documentation of commands, configuration files, system calls and library functions. Organized into 8 sections. (1=user programs, 2=kernel system calls). May need to use section number when entry exists in multiple sections (e.g. man passwd and man -S 5 passwd ). 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.) The | signifies an OR condition. (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.

Useful (File-Related) UNIX Commands ls - list content of a directory mv – move file to another location or name cp - create a copy of a file mkdir – create a new directory rm – remove a file rmdir – remove a directory

Some Additional Useful UNIX Commands who - list who is on system mailx – send/ receive mail echo, printf – display a message date – get date and time man – display documentation with a pager program uname – display machine name and OS passwd - change password script - log all interaction in a file clear - clear the screen tty – get terminal id stty – set terminal options exit – terminate session