The Command Line, Part II, Pine, and Pico CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture.

Slides:



Advertisements
Similar presentations
Microsoft Office Illustrated Fundamentals Unit C: Getting Started with Unit C: Getting Started with Microsoft Office 2010 Microsoft Office 2010.
Advertisements

 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
A Guide to Unix Using Linux Fourth Edition
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
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.
CIS 118 – Intro to UNIX Shells 1. 2 What is a shell? Bourne shell – Developed by Steve Bourne at AT&T Korn shell – Developed by David Korn at AT&T C-shell.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
1 Processes Professor Jennifer Rexford
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
1 Using Editors Editors let you create and edit ASCII files UNIX normally includes two editors: vi and Emacs Vi and Emacs are screen editors: they display.
CS 497C – Introduction to UNIX Lecture 23: - Simple Filters Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
CSCI 330 T HE UNIX S YSTEM File operations. OPERATIONS ON REGULAR FILES 2 CSCI The UNIX System Create Edit Display Contents Display Contents Print.
Introduction to Unix – CS 21 Lecture 5. Lecture Overview Lab Review Useful commands that will illustrate today’s lecture Streams of input and output File.
Unix Filters Text processing utilities. Filters Filter commands – Unix commands that serve dual purposes: –standalone –used with other commands and pipes.
UNIX Filters.
CSCI 330 T HE UNIX S YSTEM Editing files. E DITOR C ONCEPTS Editing a file is to modify the content of a file Text editor: Enter and modify text in a.
Advanced File Processing
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Chapter 3 Mastering Editors
Microsoft ® Word 2010 Core Skills Lesson 1: Getting Started Courseware #: 3240 Microsoft Office Word 2010.
Technology for Seniors Introduce the shortcuts Vocabulary and where use Exploring browser - news, use, chat, and other internet browsers Creating.
| | Tel: | | Computer Training & Personal Development Outlook Express Complete.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
1 Unix and the Internet Pine System and Netscape.
Linux+ Guide to Linux Certification Chapter Four Exploring Linux Filesystems.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
1 Day 5 Additional Unix Commands. 2 Important vs. Not Often in Unix there are multiple ways to do something. –In this class, we will learn the important.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
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.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #4  Unix software architecture  Correcting mistakes  System setups  Useful commands for the beginner.
Chapter 17 Creating a Database.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
4 Editing files and Emacs Editing files The Emacs editor.
Unix Editors. u Editors in Unix come in two general flavours: –modal editors have "modes" v generally input mode and command mode –input mode allows entry.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
By Felixberto Dominic B. Eruela.  Using a computer to create, edit, and print documents. Of all computer applications, word processing is the most common.
Introduction to Unix (CA263) File Editing By Tariq Ibn Aziz.
Chapter Three The UNIX Editors.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Tutor: Gerry Mc Cann Basic Computer Study for academic Skills.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
CHAPTER 5 Introduction to Word Processing. OBJECTIVES 1.Define common terms related to word processing 2.Create, format, edit, save, and print Microsoft.
XP Exploring Outlook  Outlook is a powerful information manager  You can use Outlook to perform a wide range of communication and organizational tasks,
Learning Unix/Linux Based on slides from: Eric Bishop.
SIMPLE FILTERS. CONTENTS Filters – definition To format text – pr Pick lines from the beginning – head Pick lines from the end – tail Extract characters.
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 5 th Edition Lesson 11 Exploring Microsoft Office Morrison / Wells / Ruffolo.
Introduction to C Topics Compilation Using the gcc Compiler
Lesson 5-Exploring Utilities
Guide To UNIX Using Linux Third Edition
Vi Editor.
Lecture 3 More on editors: emacs and vi COP 3344 Introduction to UNIX.
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Guide To UNIX Using Linux Third Edition
Tutorial of Unix Command & shell scriptS 5027
Chapter Four UNIX File Processing.
Lab 7: Filtering.
CSCI The UNIX System Editing files
Microsoft Office Illustrated Fundamentals
Day 5 Emacs Editor David A. Gaitros Department of Computer Science
Presentation transcript:

The Command Line, Part II, Pine, and Pico CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.

wc (Word Count) The wc command tells us some additional size-related statistics about the file. The wc command tells us some additional size-related statistics about the file. ls displays the size of the file in bytes ls displays the size of the file in bytes wc displays the number of lines and number of words (as well as bytes) wc displays the number of lines and number of words (as well as bytes) Arguments: -c (# bytes), -l (# newlines), -m (# characters), -w (# words) Arguments: -c (# bytes), -l (# newlines), -m (# characters), -w (# words) Example using a single file as the argument: Example using a single file as the argument: linux1-(10:48am): wc file1.txt file1.txt file1.txt Example using multiple files as arguments, separated by spaces. When we switch over to multiple files, wc also reports the grand total. Example using multiple files as arguments, separated by spaces. When we switch over to multiple files, wc also reports the grand total. linux1-(10:48am): wc file1.txt hello.c file1.txt file1.txt hello.c hello.c total Example using multiple files as arguments, using a wildcard: Example using multiple files as arguments, using a wildcard: linux1-(10:49am): wc *.txt file1.txt file1.txt file2.txt file2.txt file3.txt file3.txt total

diff (the DIFFerence between two files) In this example, there are two C source code files. There is a slight difference between the 2 files. We will show the contents of each first then use the diff command and let it spot the difference. In this example, there are two C source code files. There is a slight difference between the 2 files. We will show the contents of each first then use the diff command and let it spot the difference. linux1-(10:55am): cat foo.c /* File: hello.c * Description: This program prints the message "Hello, world.“ * Description: This program prints the message "Hello, world.“ */ */ #include #include int main() { printf("Hello, world.\n") return 0; } linux1-(10:55am): cat bar.c /* File: hello.c * Description: This program prints the message "Hello, world.“ * Description: This program prints the message "Hello, world.“ */ */ #include #include int main() { printf("Hello, world.\n"); return 0; } linux1-(10:55am): diff foo.c bar.c 18c18 <printf("Hello, world.\n") --- >printf("Hello, world.\n");

The UNIX Pipe (|) The pipe (|) creates a channel from one command to another. Think of the pipe as a way of connecting the output from one command to the input of another command. The pipe (|) creates a channel from one command to another. Think of the pipe as a way of connecting the output from one command to the input of another command. The pipe can be used to link commands together to perform more complex tasks that would otherwise take multiple steps (and possibly writing information to disk). The pipe can be used to link commands together to perform more complex tasks that would otherwise take multiple steps (and possibly writing information to disk). Examples: Examples: Count the number of users logged onto the current system. Count the number of users logged onto the current system. The who command will give us line by line output of all the current users. The who command will give us line by line output of all the current users. We could then use the wc -l to count the number of lines... We could then use the wc -l to count the number of lines... who | wc –l who | wc –l Display long listings in a scrollable page. Display long listings in a scrollable page. The lpq command will give us a list of the waiting print jobs. The lpq command will give us a list of the waiting print jobs. lpq | less lpq | less

sort (SORTs lines of text files) sort arranges lines alphabetically (or numerically with the –n option) sort arranges lines alphabetically (or numerically with the –n option) Example: Example: Display a sorted list of all users on the computer. Display a sorted list of all users on the computer. who | sort | less who | sort | less Display a list of files sorted in decreasing order by size in bytes Display a list of files sorted in decreasing order by size in bytes wc -c * | sort -nr wc -c * | sort -nr Other commands which are useful with sort: Other commands which are useful with sort: uniq : removes duplicate adjacent lines from a file uniq : removes duplicate adjacent lines from a file Example: sort file.txt | uniq Example: sort file.txt | uniq cat -n : prepends line numbers cat -n : prepends line numbers Example : sort file.txt | cat -n Example : sort file.txt | cat -n

pine (Program for Internet News and ) Pine is the University of Washington's "Program for Internet News and ". Pine is the University of Washington's "Program for Internet News and ". It is intended to be an easy-to-use program for sending, receiving, and filing Internet electronic mail messages and bulletin board (Netnews/Usenet) messages. It is intended to be an easy-to-use program for sending, receiving, and filing Internet electronic mail messages and bulletin board (Netnews/Usenet) messages. Pine Help: Help can be accessed anytime by typing the question mark character (?). Pine Help: Help can be accessed anytime by typing the question mark character (?). Links for more information about pine: Links for more information about pine: Official Pine Website: Official Pine Website: Pine Tutorial: Pine Tutorial: Pine Users Guide: guide/ Pine Users Guide: guide/ guide/ guide/

Pine Commands GENERAL – general navigation – general navigation ? – help READING MAIL r – reply f – forward s – save a message to another mail folder e – export the message to a text file COMPOSING MAIL ^r – insert file contents ^t – to files ^x – send message ^o – postpone message ^c – cancel message ^j – justify (while in header) or attach (while in body) ^k – cut line ^u – uncut line

Pico Pico is an easy-to-use editor that resembles Pine. Pico is an easy-to-use editor that resembles Pine. Think of it as a simplified version of emacs. Think of it as a simplified version of emacs. Although it lacks most of emacs' sophisticated functions, pico compensates by having virtually no learning curve associated with its use. Although it lacks most of emacs' sophisticated functions, pico compensates by having virtually no learning curve associated with its use. Unlike emacs, pico is a shell or terminal-based editor only. Unlike emacs, pico is a shell or terminal-based editor only. There are no added benefits of running pico under X window. There are no added benefits of running pico under X window. There is no toolbar, but pico always displays a list of commands at the bottom of the screen. There is no toolbar, but pico always displays a list of commands at the bottom of the screen. Pico does not have as extensive of a tutorial as EMACS, but it does offer a built in help screen. To access it type ctrl-g. Pico does not have as extensive of a tutorial as EMACS, but it does offer a built in help screen. To access it type ctrl-g. Pico - Reference Card: Pico - Reference Card: ml ml

Pico Commands ^G - Display help. ^X - Exit pico, saving buffer. ^O - Saves the current buffer to a file. ^^ - Mark cursor position as beginning of selected text. ^K - Cut selected text. Note: The selected text's boundary on the cursor side ends at the left edge of the cursor. ^U - Paste last cut text at the current position. ^W - Search for text. ^T - Invoke the spelling checker. ^L - Refresh the display. ^J - Format (justify) the current paragraph. ^V - Move forward a page of text. ^Y - Move backward a page of text. ^F - Move forward a character. ^B - Move backward a character. ^P - Move to the previous line. ^N - Move to the next line. ^A - Move to the beginning of the current line. ^E - Move to the end of the current line. ^C - Report current cursor position. ^D - Delete the character at the cursor. ^I - Insert a tab at the cursor. ^R - Insert an external file at the cursor.