UNIX Utilities Software Tools. Slide 2 Getting Started on UNIX The machines in CS Lab2 are named csl2wk01 through csl2wk41. csl2wk01 means “CSLab2, workstation#1”

Slides:



Advertisements
Similar presentations
More Shell Programming Software Tools. Slide 2 Keyword Shell Variables l The shell sets keyword shell variables. You can use (and change) them. HOME The.
Advertisements

UNIX Chapter 12 Redirection and Piping Mr. Mohammad Smirat.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Working with Files How to create, view, copy, rename and print files.
Perl Process Management Software Tools. Slide 2 system Perl programs can execute shell commands (Bourne shell) using the system function. system("date");
Perl Process Management Learning Objectives: 1. To learn the different Perl’s commands for invoking system process 2. To learn how to perform process management.
The UNIX Shell Software Tools. Slide 2 Basic Shell Syntax command [-[options]] [arg] [arg] … l The name of the command is first l Options are normally.
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.
Shell Basics CS465 - Unix. Shell Basics Shells provide: –Command interpretation –Multiple commands on a single line –Expansion of wildcard filenames –Redirection.
Using UNIX Basic Commands CS465. The Virtual Terminal You log on to Unix via a virtual terminal. –via telnet or secure shell (ssh) Your terminal session.
Introduction to UNIX CS208.
Shell Programming Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn the.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
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 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
UNIX Utilities Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn Input/Output.
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.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
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”
Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal Display a calendar for a specific year – cal 2000.
Lesson 11-Locating, Printing, and Archiving User Files.
Chapter 3: Command Line Utilities Doin’ stuff. In this chapter … Special characters Redirection More utilities than you shake a stick at.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
The “File System” Under UNIX, (almost) everything is a “file”: –Normal files –Directories –Hardware –Sockets –Pipes Things that are not files: –Users –Groups.
The Shell Chapter 7. Overview The Command Line Standard IO Redirection Pipes Running a Program in the Background Killing (a process!)
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.
De Anza College Instructor: Clare Nguyen
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT Operating Systems.
I/O and Redirection. Standard I/O u Standard Output (stdout) –default place to which programs write u Standard Input (stdin) –default place from which.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Shell Programming. The UNIX Shell  The UNIX shell listens to what you type and executes commands at your request. User command: lpr file UNIX Shell UNIX.
Chapter Four I/O Redirection1 System Programming Shell Operators.
UNIX Commands COMP 1090 Introduction to Unix Fall
Shell Programming Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn the.
Getting Started UNIX InKwan Yu Topics Unix Commands Unix System calls C function calls.
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
More Shell Programming. Slide 2 Control Flow  The shell allows several control flow statements:  if  while  for.
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.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
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).
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
The UNIX Shell Learning Objectives:
Some Linux Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Chapter Four UNIX File Processing.
Tutorial Unix Command & Makefile CIS 5027
Shell Programming.
More Shell Programming
Presentation transcript:

UNIX Utilities Software Tools

Slide 2 Getting Started on UNIX The machines in CS Lab2 are named csl2wk01 through csl2wk41. csl2wk01 means “CSLab2, workstation#1” The full machine name for csl2wk01 is: csl2wk01.cs.ust.hk

Slide 3 UNIX File Utilities ls list files in current directory cat display file more display one screen of file rm remove (delete) a file cp copy source file to target file mv rename or move a file lpr print a file man online UNIX help manual mpage print multiple pages on postscript printer (not standard UNIX command; OpenSource command)

Slide 4 UNIX File Utilities - Example $ ls letter1secret/ $ cat letter1 Ms. Lewinski: It is getting late. Please order some pizza and stop by my office. We’ll tidy up a few more things before calling it a night. Thanks! Bill $ cp letter1 letter2 $ ls letter1letter2secret/

Slide 5 File Utilities - Example con’t $ mv letter1 letter3 $ ls letter2letter3 secret/ $ lpr –Pcll2a letter2 $ mpage –Pcll2a letter2 $ rm letter2 $ ls letter3secret/

$ man ls Reformatting page. Wait... done User Commands ls(1) NAME ls - list contents of directory SYNOPSIS /usr/bin/ls [ -aAbcCdfFgilLmnopqrRstux1 ] [ file... ] /usr/xpg4/bin/ls [ -aAbcCdfFgilLmnopqrRstux1 ] [ file... ] DESCRIPTION For each file that is a directory, ls lists the contents of the directory; for each file that is an ordinary file, ls repeats its name and any other information requested. The output is sorted alphabetically by default. When no argu- ment is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments appear before directories and their contents. There are three major listing formats. The default format for output directed to a terminal is multi-column with --More--(5%)

Slide 7 The UNIX Shell l The UNIX shell listens to what you type and executes commands at your request. User command: lpr file UNIX Shell UNIX Kernel Command Library ls, lpr, mv, rm,... result or status Printers Files Memory results (on screen)

Slide 8 Popular Shells l shBourne shell (the original shell) l cshC-shell (pronounced as “sea shell”) l tschLike csh with more functions (Lab2 default) l bash“Bourne again” shell l ksh Korn shell l zsh Z-shell (not on Lab2 machines)

Slide 9 Finding Info who Who is logged on, where & when $ who horner pts/0 Jan 29 09:52 (csz469.cs.ust.hk) gbush pts/1 Jan 29 10:43 (csz213.cs.ust.hk) finger A bit more login information $ finger Login Name Tty Idle Login Time Office Office Phone horner Andrew Horner pts/0 Sep 5 10:18 (csz469.cse.ust.hk) gbush George W pts/1 121:07 Sep 5 09:06 (csz213.cse.ust.hk)

Slide 10 Finding Info write Send message to another user $ whoami horner $ write clinton Bill, you’ve been idle for a long time! What are you doing? [hit CTRL-D to end write message] $ $ whoami clinton Message from horner on csz096.cs.ust.hk [ Fri Jan 29 20:18:47. Bill, you’ve been idle for a long time! What are you doing? EOF $

Slide 11 More Utilities echo Display command line input to screen $ echo Hi, I am Bill, and she’s the boss! Hi, I am Bill, and she’s the boss! date Print the date and time $ date Tue Sep 5 12:24:07 HKT 2007

Slide 12 More Utilities l headDisplay first few lines of file $ head -2 letter3 Ms. Lewinski: It is getting late. Please order some pizza and stop l tailDisplay last few lines of file $ tail -2 letter3 Thanks! Bill l grepFind a pattern in a file $ grep ”some pizza” letter3 It is getting late. Please order some pizza and stop

Slide 13 More Utilities l sortSort the lines in lexical order $ sort letter3 Bill by my office. We'll tidy up a few more things before calling it a night. It is getting late. Please order some pizza and stop Ms. Lewinski: Thanks! $ sort -r letter3 Thanks! Ms. Lewinski: It is getting late. Please order some pizza and stop calling it a night. by my office. We'll tidy up a few more things before Bill

Slide 14 More Utilities uniq Display file with duplicate adjacent lines removed $ cat names George W. Bush Bill Gates Bill Clinton George W. Bush $ uniq names George W. Bush Bill Gates Bill Clinton George W. Bush

Slide 15 Input/Output Redirection l On UNIX, the standard input (stdin) is the keyboard; the standard output (stdout) is the display screen. $ sort waits for you to type in the data from the keyboard and displays the sorted data on the screen. sort keyboard display

Slide 16 Input/Output Redirection l Using the “>” character after a command to redirect output to a named file: $ sort names > names.sort $ uniq names.sort Bill Clinton Bill Gates George W. Bush uniq display sort names names.sort

Slide 17 Input/Output Redirection l Using the “<” character after a command to redirect input from a named file: $ uniq < names.sort This is the same as: $ uniq names.sort l Using input and output redirection together: $ sort names.sort uniq display sort names names.sort

Slide 18 Pipes l The standard output of a program can be “piped” into the standard input of another program: $ sort names | uniq Bill Clinton Bill Gates George W. Bush uniq display sort names

Slide 19 Pipes l Several pipes can be connected: $ cat names | sort | uniq Bill Clinton Bill Gates George W. Bush l Pipes and I/O redirection can be used together: $ sort -r names | uniq >names.rev $ cat names.rev George W. Bush Bill Gates Bill Clinton