Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal 12 2000 Display a calendar for a specific year – cal 2000.

Slides:



Advertisements
Similar presentations
UNIX Chapter 12 Redirection and Piping Mr. Mohammad Smirat.
Advertisements

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.
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Manipulating files in UNIX. Common operations of files Common operations: We will learn to do these operations and more.... Create a file Print a file.
Working with Files How to create, view, copy, rename and print files.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
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.
UNIX Chapter 09 Basic File Processing Mr. Mohammad Smirat.
Linux+ Guide to Linux Certification, Second Edition
Chapter 7 Advanced Directory and File Management.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Guide To UNIX Using Linux Third Edition
CS 497C – Introduction to UNIX Lecture 13: - The File System Chin-Chih Chang
9-2 How do you copy/move/rename/remove files? How do you create a directory ? What is redirection and piping? Readings: See CCSO’s Unix pages andCCSO’s.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Learning basic Unix command IT 325 operating system.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think that this is a coincidence.” Anonymous.
Notes Assignment #1 is due next Friday by 11:59 pm via Test #1 will be held Thursday February 18 at the start of class (one period long) Format:
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
Working with Files How to create, view, copy, rename and print files.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Lesson 11-Locating, Printing, and Archiving User Files.
BIF703 Miscellaneous Commands. File related commands  grep - print lines matching a pattern  head - output the first part of files  tail - output the.
Chapter 3: Command Line Utilities Doin’ stuff. In this chapter … Special characters Redirection More utilities than you shake a stick at.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Unix Basics Chapter 4.
Linux+ Guide to Linux Certification, Second Edition
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.
The UNIX development environment CS 400/600 – Data Structures.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008 Chapter 8: The UNIX File System Continued 1 of 44 Copyright ©2008 by Pearson Education, Inc. Upper.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
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
Introduction to Programming Using C An Introduction to Operating Systems.
Manipulating Files Refresher. The touch Command touch is used to create a new, empty file. If the file already exists, touch updates the time and date.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Linux - Ubuntu LECTURE TWO. Objective: Enable students to understand the practical side of Linux operating system. Understand and implement the following.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
CSCI 330 UNIX and Network Programming Unit II Basic UNIX Usage: File System.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Learning basic Unix command It 325 operating system.
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT File Processing.
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.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
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 Commands Help HANDS ON TRAINING Author: Muhammad Laique
Useful Linux Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
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.
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
Presentation transcript:

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 What if we want to save the calendar?

Creating a file with redirection Most commands send their output to the screen You can change (redirect) where you want the results sent – cal 2000 > 2001 Be careful: output redirection will overwrite the target file if it already exists

ls list Displays all files in the current directory. Flags: – -a: shows all the files, including hidden ones – -F: puts a / after directories, an * after executables, and after links – -l: displays a long listing of files – -R: will also list contents of sub-directories – -s: will list the size of the files

Viewing the file What if you want to see the contents of a file? Use the cat command – cat [name of file] – cat 2000 Use the more command – more [name of file] – more 2000

Chaining files together Use the cat command to see more than one file – cal > june – cal > july – cal > august – cat june july august Send the results to another file – cat june july august > summer2000

Appending files Unix allows you to add information to the end of a file rather than overwriting it – This is called appending Command output can be appended ‘>>’ – cal >> summer2000 The output of the cal command is appended to the end of the file summer2000 On file can be appended to the end of another using cat and redirection – cat summer2000 >> myCalendar OR – cat myCalendar summer2000 > myCalendar

cp Copies the contents of one file to another – cp [file to copy] [new file name] Flags – -r: will copy directories and all their contents – Without this flag, the directory will not be copied and you will get an error message

mv Better name could be the rename command Changes the name of one file to another – mv [old file name] [new file name] Note, if [new file name] is a directory, you will move [old file name] to that directory and keep the original name

rm remove Deletes the specified file or files This is destructive! They are gone! They cannot be retrieved! – rm [file name] rm does not work with directories – unless the –r option is used

touch Touch creates an empty file – touch [file name] – If the file already exists, touch leaves it contents But it updates the time stamp of the file Used to – Test directory permissions – Create a sample file – Update the time stamp on an existing file

lpr print command (stands for “line printer”) This prints the file(s) you specify to the printer you specify – lpr [flags] [file name(s) to print] Flags: – -P: specifies the name of the printer to print to – -w[1-n]: specifies the number of pages to print per page – -h: removes the header page

lpq view print queue – lpq stands for “line printer query” When you print a file, it gets sent to a print queue (a line of files waiting to be printed) lpq will show you the names of the files in the print queue Use the -P flag just like in lpr to specify the printer whose queue you wish to view

lprm line printer remove Used to remove a file from the print queue Use the lpq to see the file and then use lprm [job number] to remove the specific job You can only remove print jobs that you sent to the printer Use the ‘-’ flag to remove all your files