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.

Slides:



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

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.
A Practical Guide to Fedora and Red Hat Enterprise Linux Unit 4: More Command Line Interface (CLI) Chapter 7: The Linux Shell By Fred R. McClurg Linux.
January 13, Csci 2111: Data and File Structures Week1, Lecture 2 Basic File Processing Operations.
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.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
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.
Chapter 7 Advanced Directory and File Management.
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
Guide To UNIX Using Linux Third Edition
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.
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.
An Introduction to Operating Systems. Definition  An Operating System, or OS, is low-level software that enables a user and higher-level application.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Chapter 4: UNIX File Processing Input and Output.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II CHAPTER 10: ADVANCED FILE PROCESSING.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think that this is a coincidence.” Anonymous.
Linux Tools. Tar tar – (Tape Archive). This is a tool for archiving files and directory hierarchies. tar output can be sent to stdout using the – file.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
V Avon High School Tech Crew Agenda Old Business –Delete Files New Business –Week 9 Topics: Coming up: –Yearbook Picture: Feb 7 12:20PM.
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.
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.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Agenda Basic Shell Operations Standard Input / Output / Error Redirection of Standard Input / Output / Error ( >, >>,
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT I/O Redirection.
Guide To UNIX Using Linux Fourth Edition
BIF703 stdin, stdout, stderr Redirection. stdin, stdout, stderr Recall the Unix philosophy “do one thing well”. Unix has over one thousand commands (utilities)
RjpSystem Level Programming Operating Systems 1 Having fun withy the Unix Operating System Praxis Week 7 Rob Pooley.
Unix Talk #2 (sed). 2 You have learned…  Regular expressions, grep, & egrep  grep & egrep are tools used to search for text in a file  AWK -- powerful.
A Guide to Unix Using Linux Fourth Edition
Linux+ Guide to Linux Certification, Third Edition
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
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.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Operating Systems Lecture 10. Agenda for Today Review of previous lecture Input, output, and error redirection in UNIX/Linux FIFOs in UNIX/Linux Use of.
Week 9 - Nov 7, Week 9 Agenda I/O redirection I/O redirection pipe pipe tee tee.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Linux Lecture #02. File Related Commands cat --Concatenate and print (display) the content of files. --Also used to create a new file. Syntax cat [Options]
File Systems cs550 Operating Systems David Monismith.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
Linux+ Guide to Linux Certification, Second Edition
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
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).
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
UNIX The Basics Source:
Some Linux Commands.
stdin, stdout, stderr Redirection
LING 408/508: Computational Techniques for Linguists
Unix Talk #2 (sed).
Chapter Four UNIX File Processing.
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
The Linux Command Line Chapter 4
Lecture 4 Redirecting standard I/O & Pipes
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
A shell is a user interface.
The Linux Command Line Chapter 4
LPI Linux Certification
Presentation transcript:

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 stamp, indicating when the file was last accessed. Usage: –touch myfile

The mkdir command The mkdir command allows a user to create a directory. The user must have appropriate permissions. Usage: –mkdir myDirectory Use mkdir –p to automatically create any directories that may not exist when creating child directories: –mkdir –p TopDirectory/BottomDirectory

The rm Command The rm command deletes files and directories. rm will delete a file or directory rm –i will interactively ask the user whether it is safe to delete rm –r will recursively delete a directory and anything inside it

The cp Command Use cp to copy files and directories Syntax –cp source_file destination_file Multiple files may be copied at once –May use wildcards (* or ?) –May specify multiple file names in source

cp Examples

cp -i cp –i prevents overwriting (or clobbering) files that already exist. Operates similarly to rm -i

Copying Directories To copy directories, use cp –r. Copying a Directory to the Same Directory Copying a Directory to Another Directory

The mv Command To move a file or directory, or to rename a file or directory, use the mv command. Syntax –mv source_file destination_file

mv Examples Renaming a File or Directory Moving a File or Directory to a Different Directory

Input/Output Redirection Standard Input, abbreviated stdin, usually refers to the keyboard Standard Output, abbreviated stdout, usually refers to the monitor Standard Error, abbreviated stderr, usually refers to the monitor Commands commonly accept their input from stdin and send their output to stdout. Input and output can be redirected (come from a location other the stdin and sent to a location other than stdout).

Input Redirection command < input_file

Output Redirection command > output_file > replaces the file if it exists, otherwise creates it command >> output_file >> appends output to end of the file if it exists, otherwise creates it

Redirection Summary