UNIX Reference Sheets CSE 2031 Fall 2010.

Slides:



Advertisements
Similar presentations
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Advertisements

Introduction to UNIX CSE 2031 Fall May 2015.
Find Command Characteristics –Locate files descending from multiple starting points –Employs regular expressions Examples On entire system: >find / -name.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
Introduction to Linux and Shell Scripting Jacob Chan.
Shell Programming. Shell Scripts (1) u Basically, a shell script is a text file with Unix commands in it. u Shell scripts usually begin with a #! and.
Shell Script Examples.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Shell Control Structures CSE 2031 Fall August 2015.
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 Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
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.
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 Shell Script (1) Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
#!/bin/sh echo Hello World cat Firstshellscript.sh Firstshellscript.sh.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Lesson 2 1.Commands 2.Filename Substitution 3.I/O Redirection 4.Command Grouping 5.Shell Responisibilites Review of the Basics.
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.
Lecture 24CS311 – Operating Systems 1 1 CS311 – Lecture 24 Outline Final Exam Study Guide Note: These lecture notes are not intended replace your notes.
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.
(Re)introduction to Unix Sarah Medland. So Unix…  Long and venerable history  
LIN Unix Lecture 5 Unix Shell Scripts. LIN Command Coordination ; && || command1 ; command2 Interpretation: Do command 1. Then do command.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
1 Lecture 9 Shell Programming – Command substitution Regular expressions and grep Use of exit, for loop and expr commands COP 3353 Introduction to UNIX.
CISC3130 Spring 2013 Fordham Univ. 1 Bash Scripting: control structures.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
1 Unix/Linux commands and shell programming-Part 2 (Dr. Mohamed El Bachir Menai)
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
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.
Shell Scripting What is Shell Programming? Putting UNIX commands in a file Seldom used where speed is important Often used to manipulate files To create.
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
1 UNIX Operating Systems II Part 2: Shell Scripting Instructor: Stan Isaacs.
Learning Unix/Linux Based on slides from: Eric Bishop.
Linux Essentials Chapter 12: Creating Scripts. Chapter 12 Outline Beginning a shell script Using commands Using arguments Using variables Using conditional.
Shell Control Structures CSE 2031 Fall June 2016.
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.
Shell Control Structures
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
The UNIX Shell Learning Objectives:
Part 1: Basic Commands/Utilities
Lecture 2 Working with Files and Directories
Some Linux Commands.
Shell Scripting March 1st, 2004 Class Meeting 7.
Lecture 9 Shell Programming – Command substitution
Shell Programming (ch 10)
Shell Script Assignment 1.
CSE 374 Programming Concepts & Tools
INTRODUCTION TO UNIX: The Shell Command Interface
Basic UNIX OLC Training.
Agenda Control Flow Statements Purpose test statement
Pepper (Help from Dr. Robert Siegfried)
CS 60 Discussion Review.
The Unix File System.
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Shell Control Structures
Shell Control Structures
Introduction to UNIX (part 2)
Introduction to UNIX (part 2)
Introduction to Bash Programming, part 3
Introduction to UNIX EECS July 2019.
Review.
Presentation transcript:

UNIX Reference Sheets CSE 2031 Fall 2010

Wildcards (File Name Substitution) ? match single character * match any number of characters […] match any character in the list enclosed by [ ] We can combine different wildcards.

File Manipulation Commands ls, cp, mv, rm touch pwd, mkdir, rmdir cd chmod, chown, chgrp find % find . -name "e*.c" % find ~ -type f

Commonly Used Commands Get on-line help with man Some commonly used commands cat, more who, echo, date cmp, diff sort wc ps, kill history grep -i case insensitive -l display only file name -n display line numbers -v lines that do not contain pattern

Commonly Used Commands (2) % wc file % wc –c file % wc –w file % wc –l file sort –r reverse normal order sort –n numeric order sort –nr reverse numeric order sort –f case insensitive

File/Directory Permissions

Pre-defined “Variables” $# represents the number of command line arguments $* represents all the command line arguments $@ represents all the command line arguments $$ represents the process ID of the shell $? represents the exit status code of the command last executed

User Variables expr utility name=value read name echo $name sum=`expr $op1 + $op2` echo $sum

if Statement and test Command if condition then command(s) elif condition_2 else fi

test Command ─e file file or directory exists

test Command (2) Parentheses can be used for grouping test conditions. Logical operators: ! || &&

for Loops for variable in list do command(s) done variable is a user-defined variable. list is a sequence of strings separated by spaces.

while Loops while condition do command(s) done Command test is often used in condition. Execute command(s)when condition is met.

until Loops until condition do command(s) done Command test is often used in condition. Exit loop when condition is met.

case Statement case variable in pattern1) command(s);; pattern2) command(s);; . . . patternN) command(s);; *) command(s);; # all other cases esac

Shell Functions # function declaration and implementation my_function() { commands } # caller my_function