CIS 90 - Lesson 6 Lesson Module Status Slides – basics Test ready and copies made - Properties - done Flash cards – No-stress quiz – done Web Calendar.

Slides:



Advertisements
Similar presentations
Pre-Assessment Questions
Advertisements

Working with Files How to create, view, copy, rename and print files.
Lab6 CPCS361 I.Mona Alshehri. Working with Files and Directories Creating files Create a file with the cat command type the command cat > name_of_file.
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
CS 497C – Introduction to UNIX Lecture 12: - The File System Chin-Chih Chang
CS 497C – Introduction to UNIX Lecture 16: - File Attributes Chin-Chih Chang
UNIX Chapter 00 A “ Quick Start ” into UNIX Operating System Mr. Mohammad Smirat.
Chapter 6 Basic Directory and File Management. Command Line Control Characters Control-s - Stops screen output - rarely used Control-q - Resumes screen.
Copyrights© 2008 BVU Amplify DITM DATA BASE MANAGEMENT system Page:1 Lesson 2: The File System By Simi.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Learning basic Unix command IT 325 operating system.
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 Day 3 Directories Files Moving & Copying. 2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
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”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
CIS 90 - Lesson 6 Lesson Module Status Slides – basics Test ready and copies made - Properties - done Flash cards – No-stress quiz – done Web Calendar.
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.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
CIS 90 - Lesson 15 Lesson Module Status Slides – draft Properties - done Flash cards – 1 st Minute quiz – NA Web calendar summary – done Web book pages.
CIS 90 - Lesson 14 Lesson Module Status Slides – Properties - Flash cards – No-stress quiz – Web calendar summary – Web book pages – Commands – Lab – done.
Linux+ Guide to Linux Certification, Second Edition
CIS 90 - Lesson 7 Lesson Module Status Slides – draft Properties - done Flash cards – No-stress quiz – Web Calendar summary – Web book pages – done Commands.
CIS 90 - Lesson 15 Lesson Module Status Slides – Properties - Flash cards – No-stress quiz – Web calendar summary – Web book pages – Commands – Lab – done.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
CIS 90 - Lesson 7 Lesson Module Status Slides – draft Properties - done Flash cards – No-stress quiz – Web Calendar summary – Web book pages – done Commands.
BIF703 Hard & Symbolic Links. What is a file system Link? A link is a pointer to a file. This pointer associates a file name with a number called an i-node.
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.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Introduction To UNIX. FAQReferencesSummaryInfo Resources Introduction Learning Objectives Log on User Interface Commands List of Commands Useful Info.
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
Linux+ Guide to Linux Certification, Third Edition
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Λειτουργικά Συστήματα – 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.
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.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
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.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Linux Filesystem Management
CS1010: Intro Workshop.
Chapter 11 Command-Line Master Class
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 file system "On a UNIX system, everything is a file;
Scoutmaster, Scoutmaster he's our man. If he can't do it, nobody can.
Lecture 2 Working with Files and Directories
Operating Systems and Using Linux
Web Programming Essentials:
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
The Linux Command Line Chapter 4
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
The Linux Command Line Chapter 4
Presentation transcript:

CIS 90 - Lesson 6 Lesson Module Status Slides – basics Test ready and copies made - Properties - done Flash cards – No-stress quiz – done Web Calendar summary – done Web book pages – done Commands – done Skills pacing - NA Lab – done Supplies – NA Class PC's – NA 1

CIS 90 - Lesson 6 ObjectivesAgenda Be able to create, copy, move, remove and link files Planning survey Housekeeping Managing files Wrap up Test  = hands on exercise for topic Managing Files 2

Housekeeping 3

CIS 90 - Lesson 6 Previous material and assignment 1.Questions on previous material or labs? 2.MSDN AA working? 3.Installfest this Friday 4

Managing Files 5

Managing the UNIX/Linux File System Objectives CIS 90 - Lesson 6 Name the three elements of a Unix file, and where each is stored. Be able to manage the files in your home directory using: mkdir cp mv rmdir rm ln 6

CIS 90 – Lesson 6 UNIX Files The three elements of a file /home/cis90/simmsben/Poems $ ls ant Blake nursery Shakespeare twister Yeats /home/cis90/simmsben/Poems $ ls -l twister -rw-r--r-- 1 simmsben cis Jul twister /home/cis90/simmsben/Poems $ cat twister A tutor who tooted the flute, tried to tutor two tooters to toot. Said the two to the tutor, "is it harder to toot? Or to tutor two tooters to toot?" 7

CIS 90 - Lesson 6 Partition Boot Sector Data Master Boot Record (MBR) Partition Boot Sector Data Partition Boot Sector Data Partition Boot Sector Data Unused Boot Sector Data Unused Boot Sector File Systems Linux Superblock Inode Table ext2 file system Data Blocks 8

CIS 90 - Lesson 6 Superblock Inode Table ext2 file system Data Blocks ~]$ls -il letter rw-r--r-- 1 simmsben cis Jul letter Hello Mother! Hello Father! Here I am at Camp Granada. Things are very entertaining, and they say we'll have some fun when it stops raining. All the counselors hate the waiters, and the lake has alligators. You remember Leonard Skinner? He got ptomaine poisoning last night after dinner. Now I don't want this to scare you, but my bunk mate has malaria. You remember Jeffrey Hardy? Their about to organize a searching party. Take me home, oh Mother, Father, take me home! I hate Granada. Don't leave me out in the forest where I might get eaten by a bear! Take me home, I promise that I won't make noise, or mess the house with other boys, oh please don't make me stay -- I've been here one whole day. Dearest Father, darling Mother, how's my precious little brother? I will come home if you miss me. I will even let Aunt Bertha hug and kiss me! Wait a minute! It's stopped hailing! Guys are swimming! Guys are sailing! Playing baseball, gee that's better! Mother, Father, kindly disregard this letter. Alan Sherman bigfile bin letter bigfile bin letter simmsben cis Pointer(s) to data blocks inode number Type Number of links User Group Size Modification time Access Time Change time Pointer(s) to data blocks rw-r—r-- Permissions 9

Create 10

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: touch creates an empty ordinary file(s), or if the file already exists, it updates the time stamp. mkdir creates an empty directory(s) options: -p echo "string" > new file Creates or overwrites a text file 11

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: touch creates an empty ordinary file(s), or if the file already exists, it updates the time stamp. /home/cis90/simmsben $ ls -l sawyer ls: sawyer: No such file or directory /home/cis90/simmsben $ touch sawyer /home/cis90/simmsben $ ls -l sawyer -rw-rw-r-- 1 simmsben cis90 0 Mar 18 06:34 sawyer /home/cis90/simmsben $ 12 A new file, named sawyer is created in the current working directory An empty file

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: touch creates empty ordinary file(s), or if the file(s) already exist, the time stamp(s) are updated. /home/cis90/simmsben $ ls -l sawyer -rw-rw-r-- 1 simmsben cis90 0 Mar 18 06:34 sawyer /home/cis90/simmsben $ touch sawyer /home/cis90/simmsben $ ls -l sawyer -rw-rw-r-- 1 simmsben cis90 0 Mar 18 06:36 sawyer /home/cis90/simmsben $ 13 The Last Modified timestamp for sawyer is updated Last modified

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: mkdir creates empty directory(ies) options: -p /home/cis90/simmsben $ ls -l island ls: island: No such file or directory /home/cis90/simmsben $ mkdir island /home/cis90/simmsben $ ls -ld island drwxrwxr-x 2 simmsben cis Mar 18 06:43 island 14 Create a new directory named island file type is directory d option used to list information about the directory itself rather than its contents

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: mkdir creates empty directory(ies) options: -p /home/cis90/simmsben $ mkdir africa/ghana mkdir: cannot create directory `africa/ghana': No such file or directory /home/cis90/simmsben $ mkdir -p africa/ghana /home/cis90/simmsben $ ls africa ghana /home/cis90/simmsben $ 15 Create a new directory named ghana in a new directory named africa Need to use the p option for creating multiple new nested directories

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: echo "string" > new file Creates or overwrites a text file /home/cis90/simmsben $ cd africa /home/cis90/simmsben/africa $ ls ghana /home/cis90/simmsben/africa $ cd ghana /home/cis90/simmsben/africa/ghana $ echo Population 1,658,937 > accra /home/cis90/simmsben/africa/ghana $ cat accra Population 1,658, Creating a file named accra and adding some text to it Output of the echo command is redirected from the screen to a file named accra

Managing the UNIX/Linux File System Creating CIS 90 - Lesson 6 Commands: echo "string" > new file Creates or overwrites a text file /home/cis90/simmsben/africa/ghana $ cat accra Population 1,658,937 /home/cis90/simmsben/africa/ghana $ > accra /home/cis90/simmsben/africa/ghana $ cat accra /home/cis90/simmsben/africa/ghana $ 17 The redirection character > will create the file named if it does not exist and empty it if it does exist

CIS 90 - Lesson 6 Class Exercise In your home directory create a directory named characters inside a directory name island. mkdir -p island/characters In the directory named characters create three files: sawyer, kate and hurley Add some text of the new files: echo "Katherine Anne Austin" > kate echo "James Ford" > sawyer echo "Hugo Reyes" > hurley Print all files with cat * Empty the file hurley > hurley 18

Listing 19

Managing the UNIX/Linux File System CIS 90 - Lesson 6 /home/cis90/simmsben $ ls island characters /home/cis90/simmsben $ ls -R island island: characters island/characters: hurley kate sawyer 20 Short listing Short recursive listing

/home/cis90/simmsben $ ls -l island total 8 drwxrwxr-x 2 simmsben cis Mar 18 07:25 characters /home/cis90/simmsben $ ls -lR island island: total 8 drwxrwxr-x 2 simmsben cis Mar 18 07:25 characters island/characters: total 24 -rw-rw-r-- 1 simmsben cis90 11 Mar 18 07:25 hurley -rw-rw-r-- 1 simmsben cis90 22 Mar 18 07:25 kate -rw-rw-r-- 1 simmsben cis90 11 Mar 18 07:25 sawyer /home/cis90/simmsben $ Managing the UNIX/Linux File System CIS 90 - Lesson 6 21 Long listing Long recursive listing

Managing the UNIX/Linux File System CIS 90 - Lesson 6 /home/cis90/simmsben $ tree island island `-- characters |-- hurley |-- kate `-- sawyer 1 directory, 3 files /home/cis90/simmsben $ 22 Making a directory tree diagram Putty must be configured to use UTF-8

Managing the UNIX/Linux File System CIS 90 - Lesson 6 23 Putty must be configured to use UTF-8

CIS 90 - Lesson 6 Class Exercise Return to your home directory with cd Do a short listing of the island directory with ls island Do a short recursive listing of the island directory ls –R island Do a long listing of the island directory with ls –l island Do a long recursive listing of the island directory with ls –lR island Do a long recursive listing of your home directory with ls –lR Make tree diagram of island with tree island 24

copy 25

Managing the UNIX/Linux File System Copying CIS 90 - Lesson 6 Commands: cp or cp or cp options: -i –r i = warns before overwriting r = recursive (copies all sub folders) 26

Managing the UNIX/Linux File System Copying CIS 90 - Lesson 6 Commands: cp /home/cis90/simmsben $ cd /home/cis90/simmsben $ cd island/characters/ /home/cis90/simmsben/island/characters $ ls hurley kate sawyer /home/cis90/simmsben/island/characters $ echo "Hugo Reyes" > hurley /home/cis90/simmsben/island/characters $ cp hurley hurley.bak /home/cis90/simmsben/island/characters $ ls hurley hurley.bak kate sawyer /home/cis90/simmsben/island/characters $ cat hur* Hugo Reyes 27 Make a copy of the hurley file Note: using a relative pathname

Managing the UNIX/Linux File System Copying CIS 90 - Lesson 6 Commands: cp /home/cis90/simmsben/island/characters $ ls hurley hurley.bak kate sawyer /home/cis90/simmsben/island/characters $ mkdir backup /home/cis90/simmsben/island/characters $ cp hurley kate sawyer backup/ /home/cis90/simmsben/island/characters $ ls backup hurley kate sawyer /home/cis90/simmsben/island/characters $ 28 Make a new directory called backup Copy three files to the new directory List the three files in the new directory

Managing the UNIX/Linux File System Copying CIS 90 - Lesson 6 Commands: cp /home/cis90/simmsben/island/characters $ cp * backup/ cp: omitting directory `backup' /home/cis90/simmsben/island/characters $ ls backup/ hurley hurley.bak kate sawyer /home/cis90/simmsben/island/characters $ 29 Copy all files to the new directory List the four files in the new directory Note: copying a file to an existing file will overwrite that file Although * matches backup, it is not included in the copy

Managing the UNIX/Linux File System Copying CIS 90 - Lesson 6 options: -i –r i = warns before overwriting r = recursive (copies all sub folders) /home/cis90/simmsben/island/characters $ ls h* hurley hurley.bak /home/cis90/simmsben/island/characters $ cp -i hurley hurley.bak cp: overwrite `hurley.bak'? yes /home/cis90/simmsben/island/characters $ 30 The i option provides some interaction with the user before overwriting a file

Managing the UNIX/Linux File System Copying CIS 90 - Lesson 6 options: -i –r i = warns before overwriting r = recursive (copies all sub folders) /home/cis90/simmsben/island/characters $ cd.. /home/cis90/simmsben/island $ ls characters /home/cis90/simmsben/island $ cp -r characters players /home/cis90/simmsben/island $ ls -R players players: backup hurley hurley.bak kate sawyer players/backup: hurley hurley.bak kate sawyer /home/cis90/simmsben/island $ 31 Do recursive copy of the characters directory to a new players directory

CIS 90 - Lesson 6 Class Exercise 32 Change to your island directory using an absolute path cd /home/cis90/simmsben/island/characters/ Make a backup copy of kate cp kate kate2 Copy hurley to kate using interactive mode cp -i hurley kate (Respond with yes to overwrite) cat kate Restore kate from the backup copy cp kate2 kate cat kate Use your own username

move 33

Managing the UNIX/Linux File System Moving CIS 90 - Lesson 6 Commands: mv or mv or mv options: -i i = warns before overwriting 34

Managing the UNIX/Linux File System Renaming CIS 90 - Lesson 6 Commands: mv 35 This is how you rename files in UNIX/Linux

CIS 90 - Lesson 6 Class Exercise 36 Change to your island directory using an absolute path cd /home/cis90/simmsben/island/characters/ Rename kate to katherine mv kate katherine cat katherine Create a new file named jin and rename it to be hidden touch jin mv jin.jin (verify with ls and ls –a) Use your own username

remove 37

Managing the UNIX/Linux File System Removing CIS 90 - Lesson 6 Commands: rm... options: -i -r –f i = prompt before remove r = recursive (delete subdirectories) f = force (never prompt) rmdir Directories must be empty for this to work 38

Managing the UNIX/Linux File System Removing CIS 90 - Lesson 6 Commands: rm... options: -i -r –f i = prompt before remove r = recursive (delete subdirectories) f = force (never prompt) /home/cis90/simmsben/island/characters $ ls backup hurley hurley.bak kate2 katherine sawyer /home/cis90/simmsben/island/characters $ rm h* k* /home/cis90/simmsben/island/characters $ ls backup sawyer 39 Remove all files except for sawyer (using filename expansion characters)

Managing the UNIX/Linux File System Removing CIS 90 - Lesson 6 Commands: rm... options: -i -r –f i = prompt before remove r = recursive (delete subdirectories) f = force (never prompt) /home/cis90/simmsben/island/characters $ ls backup sawyer /home/cis90/simmsben/island/characters $ rm -i sawyer rm: remove regular file `sawyer'? yes /home/cis90/simmsben/island/characters $ ls backup 40 Remove sawyer file interactively

Managing the UNIX/Linux File System Removing CIS 90 - Lesson 6 Commands: rm... options: -i -r –f i = prompt before remove r = recursive (delete subdirectories) f = force (never prompt) /home/cis90/simmsben/island/characters $ ls backup /home/cis90/simmsben/island/characters $ mv backup/*. /home/cis90/simmsben/island/characters $ ls backup hurley hurley.bak kate sawyer /home/cis90/simmsben/island/characters $ rmdir backup /home/cis90/simmsben/island/characters $ ls hurley hurley.bak kate sawyer 41 Move the files in the backup directory to the current directory and then remove the backup directory

CIS 90 - Lesson 6 Class Exercise 42 Change to your island directory using an absolute path cd /home/cis90/simmsben/island/characters/ Remove all files except sawyer ls rm h* k* (use ls to verify) Remove sawyer interactively with rm -i sawyer and use ls to verify Move the files in backup/ to the current directory mv backup/*. Remove the backup directory with rmdir backup/ Use your own username

links 43

Managing the UNIX/Linux File System Linking CIS 90 - Lesson 6 Commands: ln options: -s s = symbolic link (like Windows shortcut) 44

Managing the UNIX/Linux File System Linking CIS 90 - Lesson 6 Commands: ln /home/cis90/simmsben/island/characters $ ln kate katy /home/cis90/simmsben/island/characters $ ls -li k* rw-rw-r-- 2 simmsben cis90 22 Mar 18 07:59 kate rw-rw-r-- 2 simmsben cis90 22 Mar 18 07:59 katy 45 Use hard links to have multiple names for the same file same inode number of hard linked files

Managing the UNIX/Linux File System Linking CIS 90 - Lesson 6 46 Commands: ln options: -s s = symbolic link (like Windows shortcut) /home/cis90/simmsben/island/characters $ ln -s hurley hugo /home/cis90/simmsben/island/characters $ ls -li hu* lrwxrwxrwx 1 simmsben cis90 6 Mar 18 09:09 hugo -> hurley rw-rw-r-- 1 simmsben cis90 11 Mar 18 07:59 hurley Symbolic links are like Windows shortcuts. They are two separate files and it is possible to break the links when the target files get renamed. Different inodes l for symbolic link, - for regular file

CIS 90 - Lesson 6 Class Exercise Hard line kate and katy with ln kate katy Use cat ka* and ls –l ka* to show Create symbolic link hugo to hurley ln -s hurley hugo Use cat hu* and ls –l hu* to show Break the link with mv hurley hurley2 Show broken link with cat hugo Fix link with mv hurley2 hurley 47

Test 1 48

Test CIS 90 - Lesson 6 30 questions, 30 points, plus some extra credit ~15 questions taken from CIS 90 Lesson 1-5 flashcards ~15 operational questions based on using commands used in labs 1-4 Open book, open notes, open computer Local access to the Red Hat VM Remote access to Opus t are the three 49

CIS 90 - Lesson 6 Frodo VMware Server icon on Windows desktop Choose Local host for local VMs to access local VMs. Note: If you don't see this choice, wait a minute or two and try again. This can happen if you just booted up the PC and not all the VMware services have started up. Login Use F9 to toggle Inventory panel, select 192-Frodo VM, revert to snapshot, then start the VM 50

CIS 90 - Lesson 6 Graphical terminal on Frodo Type commands Open graphical terminal on Frodo by double clicking on icon 51

CIS 90 - Lesson 6 Remote access to Opus (from Windows) Using Putty (SSH) Putty icon on Windows desktop Configure remote host to connect to and protocol to use Terminal window to login and enter commands Opus (a RHEL server) 52

53

CIS 90 - Lesson 6 Wrap up 54

CIS Lesson 6 New commands: cpcopy files lnlink files mkdirmake directory mvmove or rename files rmremove files rmdirremove directory touchmake/modify a file 55

CIS 90 - Lesson 6 Next Class Assignment: Check Calendar Page on web site to see what is due next week: Quiz questions for next class: What command is used to rename a file? If two files are hard linked do they have the same or different inode numbers? What option for the rm command provides confirmation when deleting files? 56

CIS 90 - Lesson 6 Backup 57