CS 497C – Introduction to UNIX Lecture 7: General-Purpose Utilities Chin-Chih Chang

Slides:



Advertisements
Similar presentations
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.
Advertisements

Introduction to UNIX CSE 2031 Fall May 2015.
A Guide to Unix Using Linux Fourth Edition
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 24: - Simple Filters Chin-Chih Chang
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Lesson 22 – Introduction to Linux Systems Administration.
CS 497C – Introduction to UNIX Lecture 21: - The Shell Chin-Chih Chang
Linux+ Guide to Linux Certification, Second Edition
CS 497C – Introduction to UNIX Lecture 23: - Simple Filters Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 16: - File Attributes Chin-Chih Chang
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.
Guide To UNIX Using Linux Third Edition
CS 497C – Introduction to UNIX Lecture 13: - The File System Chin-Chih Chang
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.
2 $ command Command Line Options ls –a –l hello hi Command Arguments.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Advanced File Processing
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
A Guide to Unix Using Linux Fourth Edition
Unix programming Term: III B.Tech II semester Unit-II PPT Slides Text Books: (1)unix the ultimate guide by Sumitabha Das (2)Advanced programming.
Title Slide CSS 404/504 The UNIX Operating System (2) By Ralph B. Bisland, Jr.
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
©NIIT Collaborate Lesson 1C / Slide 1 of 23 Collaborate Knowledge Byte In this section, you will learn to: Use the cal command Determine the file types.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
1 Lecture 5 Additional useful commands COP 3353 Introduction to UNIX.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Linux Operations and Administration
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.
De Anza College Instructor: Clare Nguyen
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
Day 6 COP 3502 David A. Gaitros Department of Computer Science Florida State University.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Chapter Four I/O Redirection1 System Programming Shell Operators.
Chapter Six Introduction to Shell Script Programming.
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.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
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.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
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.
1 Linux Commands. 2 Path You specify a file or directory by its path name:  the full, or absolute, path name or the one relative to a location. The full.
Introduction to UNIX.
Lesson 5-Exploring Utilities
LINUX LANGUAGE MULTIPLE CHOICE QUESTION SET-5
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Chapter 6 Filters.
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Chapter Four UNIX File Processing.
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Presentation transcript:

CS 497C – Introduction to UNIX Lecture 7: General-Purpose Utilities Chin-Chih Chang

script: Record Your Session If you want to keep track of all your activities, you can invoke the script command after you log in: $ script Script started, file is typescript $ All your keystrokes that you enter get recorded in the file typescript.

script: Record Your Session You can view this file with the cat command. Script overwrites any previous typescript file. To append activities to existing file typescript, use: script -a To log activities to a different log file, use: script logfile

clear and tput: Clear Your Screen There are two commands available in most UNIX systems to clear your screen – clear and tput. The clear command is used without arguments: clear The tput command is used with the clear argument: tput clear

clear and tput: Clear Your Screen tput can als position the cursor at a specific location or be used to highlight text. tput cup You can boldface your text by using the smso and rmso arguments. smso starts highlighting the text and rmso ends highlighting. tput smso echo Come to the Web tput rmso

uname: Know Your Machine’s Name If your machine is connected to the Internet, then your machine name forms part of your machine’s domain name (a series of words separated by dots). Use –n option to show the machine name in a network: $ uname –n sisko Use –r option to show the operating system’s version.

date: Display The System Date The UNIX system maintains an internal clock meant to run perpetually. When the system is shut down, a battery backup keeps the clock ticking. The clock actually stores the number of seconds elapsed since January 1, You can display the current date with the date command.

date: Display The System Date The date command can display specific format by a + symbol followed by the % operator and a single character describing the format: –d – the day of the month (1 to 31) –m – month in the number format (1 to 12) –h – month name –y – the last two digits of the year –H, M, and S – the hour, minute and second, respectively.

date: Display The System Date You can combine them in the format where the + symbol precedes a string which specifies the requested format within a pair of “ symbols. To show the month name, date, and, you can use the following command: $ date +”%h %d %y” Sep 3 01 To change the system date, you need the administrator permission.

cal: The Calender cal is a handy tool that you can invoke anytime to see the calendar of any specific month or a complete year. To show December, use: $ cal dec To show the year of 2002, use: $ cal 2002 | more The | symbol connects two commands (in a pipeline) where more takes input from the cal command.

calendar: A useful Reminder Mechanism The calendar command provides a useful reminder mechanism for a user. The command searches a file named calendar in the current directory $ cat calendar Sep 3 Labor Day Sep 5 Howework Due

calendar: A useful Reminder Mechanism You can use date and calendar in a sequence to show those lines containing today’s and tomorrow’s dates. $ date Mon Sep 3 12:30:14 CDT 2001 $ calendar Sep 3 Labor Day

bc: The Calculator Two types of calculators are available in UNIX – a graphical object (the xcalc command) and the character-based bc command. bc belongs to a family of commands (called filters) that expect input from the keyboard when used without any argument. Key in the following arithmetic expression: $ bc

bc: The Calculator bc added the two numbers and showed the output in the next time. To quit bc, you have to use [Ctrl-d] that marks the end of input. You can also ask bc to perform calculations together: 12*12; 2^

bc: The Calculator By default, bc performs truncated division, and you have to set scale to the number of digits of precision before you perform any division: 9/5 1 scale = 2 17/7 2.42

bc: The Calculator bc is quite useful in converting numbers from one base to another. An example to convert a binary number to a decimal one is shown as follows: ibase=

bc: The Calculator The reverse is possible: obase = You can convert from one base to the another: obase = E

bc: The Calculator bc can be used with variables: x = 3; y = 4; z = 5 p = x + y + z p 12 bc is a pseudo-programming language featuring arrays, functions, conditionals ( if ) and loops ( for and while ). It also comes with a library for performing scientific calculations.

More General Purpose Commands Copy, rename and delete files with cp, mv and rm. View and print a file with cat, more, and lp. Compress a file with compress and gzip. Find out disk space utilization with df and du.

More General Purpose Commands Extract the two ends of a file with head and tail. Cut and past a file with cut and paste. Find differences between two files with comm, cmp, and diff. Sort a file’s contents with sort.