Working with Files How to create, view, copy, rename and print files.

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

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
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.
Exploring the UNIX File System and File Security
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 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
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.
Basic UNIX © McGraw Hill All rights reserved.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Review for Exam 1 Exam 1 on June 24 CSC 3320.
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.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
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.
The file structure and related utilities CS240 Computer Science II.
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”
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
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ı.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
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.
Introduction to Unix Bent Thomsen Institut for Datalogi Aalborg Universitet.
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.
Unix Basics Chapter 4.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
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.
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.
Introduction to UNIX. 2 Unix File System zDirectory Organization zHierarchy of Files & Directories.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
1 Advanced Unix Commands How Unix works along with some additional, useful Unix commands you might like to know.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
E X C E E D I N G E X P E C T A T I O N S Basic LINUX Linux System Administration Dr. Hoganson Kennesaw State University Operating Systems Directory structure:
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.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 3 rd, 2009 Essential Unix Commands …the second half.
Files and Directories in UNIX The first file in UNIX file system is “root” or “/”
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Just like DOS or Windows.
Learning basic Unix command It 325 operating system.
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 Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
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.
Andy Wang Object Oriented Programming in C++ COP 3330
The Command Prompt Commands are the way to “do things” in Unix
Useful Linux Commands.
Operating Systems and Using Linux
The Unix File System.
Introduction Paul Flynn
Andy Wang Object Oriented Programming in C++ COP 3330
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 How to create, view, copy, rename and print files.

Create a Calendar zCreate a calendar for a specific month ycal zCreate a calendar for a specific year ycal 2000

Creating a file with redirection zMost commands send their output to the screen. zYou can change (redirect) where you want the results sent. ycal 2000 > 2001

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

Viewing the file zWhat if you want to see the contents of a file? zUse the cat command ycat [name of file] ycat 2000 zUse the more command ymore [name of file] ymore 2000

Chaining files together zUse the cat command to see more than one file ycal > june ycal > july ycal > august ycat june july august zSend the results to another file ycat june july august > summer2000

Appending files zUnix allows you to add information to the end of a file rather than overwriting it. zThis is called appending and is done with the >> ycal >> summer2000

cp zcopy zCopies the contents of one file to another. ycp [file to copy] [new file name] zFlags y-r: will copy directories and all their contents. yWithout this flag, the directory will not be copied and you will get an error message.

mv zmove zBetter name could be the rename command. zChanges the name of one file to another. ymv [old file name] [new file name] zNote, if [new file name] is a directory, you will move [old file name] to that directory and keep the original name.

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

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

lprm zline printer remove zUsed to remove a file from the print queue. zUse the lpq to see the file and then use lprm [job number] to remove the specific job. zYou can only remove print jobs that you sent to the printer. zUse the ‘-’ flag to remove all your files.

rm zremove zDeletes the specified file or files. zThis is destructive! zThey are gone! zThey cannot be retrieved!!! yrm [file name] zNote: this does not generally work with directories.

Working with Directories A directory is just a file that contains other files. Now we will learn commands to create directories, move files between directories, rename files and delete directories.

mkdir zmake directory zThis creates a directory. ymkdir [new directory name] ymkdir calendar

Moving files between directories zWhen you create a directory, it contains no files. zYou need to put files into it with the mv command. ymv summer2000 calendar

zYou can create subdirectories within directories. ymkdir calendar/months zYou can move files into those subdirectories ymv june calendar/months zYou can use other commands in a similar manner yls calendar/months yls / Using pathnames

cd zchange directory zChanges the directory to whatever you specify. ycd [name of directory] zWithout any directory (just cd) you will be taken to your home directory.

pwd zprint working directory zDisplays the full path of the current directory you are in.

rmdir zremove directory zThis deletes a directory (as opposed to the rm command above). zThe directory must be empty otherwise you will get an error.

Reading zChapters 7 and 8 zAccess PrivilegesAccess Privileges