2 Manual & Filestore. Introduction Using the manual The UNIX filestore File permissions.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

The Unix File System. What are the three parts of every file on a Unix filesystem? And where is each stored? Filename - stored in directories Inode -
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
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.
Linux+ Guide to Linux Certification, Second Edition
Linux+ Guide to Linux Certification, Second Edition
UNIX Files and Security Software Tools. Slide 2 File Systems l What is a file system? A means of organizing information on the computer. A file system.
Basic UNIX © McGraw Hill All rights reserved.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
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.
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”
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.
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.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Exam Revision. Exam Details Time 90 minutes (1hour 30 minutes). Six questions! How long per question? Five parts per question. How long for each part?
Unix Basics Chapter 4.
Title Slide CSS 404/504 The UNIX Operating System (2) By Ralph B. Bisland, Jr.
Linux+ Guide to Linux Certification, Second Edition
Working with Linux Lab 1 1. Login and logout Account – username & password – Note: Linux is case-sensitive Administrator: username = root Logout: exit,
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Chapter Two Exploring the UNIX File System and File Security.
Week 3 Exploring Linux Filesystems. Objectives  Understand and navigate the Linux directory structure using relative and absolute pathnames  Describe.
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.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Chapter Two Exploring the UNIX File System and File Security.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Intro to UNIX Presented by: Student Ambassadors: Lauren Lewis Martin Sung.
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:
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Introduction to Programming Using C An Introduction to Operating Systems.
Linux Commands C151 Multi-User Operating Systems.
Revision: Absolute and relative paths. (root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt CUA xxx02uxxx04u.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
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.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
The Unix File sytem. Introduction Tree structure …
UNIX file systems Learning Objectives: 1. To understand the basics of file systems 2. To understand the hierarchical structure in Unix file system 3. To.
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
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.
Tutorial of Unix Command & shell scriptS 5027
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.
Lecture 2 Working with Files and Directories
Some Linux Commands.
C151 Multi-User Operating Systems
The Command Prompt Commands are the way to “do things” in Unix
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Tutorial of Unix Command & shell scriptS 5027
Using Linux Commands Lab 3.
Exploring the UNIX File System and File Security
Tutorial of Unix Command & shell scriptS 5027
Introduction Paul Flynn
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
Presentation transcript:

2 Manual & Filestore

Introduction Using the manual The UNIX filestore File permissions

The on-line manual man gives detailed information about UNIX commands and other facilities Details include command format, description, examples, known problems, related files and commands Sections for commands, programming, admin and others man intro for the introduction man man (of course)

UNIX Filestore Files and directories The filesystem hierarchy File handling commands Permissions

Files From the user’s point of view, all information on the computer is stored in files Files may contain many kinds of information, including programs, data and documents Like paper files, they have a name (chosen by the user) and some content By convention, the filename suffix suggests the type of content In some operating systems (for example Unix) it is optional, while in some others (such as Windows) it is a requirement UnixWindowsrequirement

Example files Me.sh = Shell script Me.pl = Perl script Me.txt = Text file Me.jpg, Me.png, Me.gif = Image files Me.html = HTML web page file Me.zip, Me.gz Me.bz2 = Compressed file Me.tar = Archived file Me.log = Log file These are just conventions and are not enforced by the operating system!

Directories Files are stored in directories (folders in Windows) Each directory may contain many files and also other directories By convention, directory names do not usually have suffixes (why not?) A file should have an extension (why?)

The filestore There is a single hierarchical filestore that is shared by all users It might be spread over the network, may involve many disks on may different computers and may even be linked to other filestores

Each user has their own personal home directory (~) There are also common areas for programs, administration, etc. The filestore starts at the root directory (/) A user is always in a current working directory (CWP) from which they give commands to access files When users log on, the CWP is set to their home directory The filestore

(root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt CUA xxx02uxxx04u MVR Lecture1.ppt Lecture2.doc.profile The filestore

Absolute and Relative Pathnames There are two ways of specifying filenames –from the current directory - relative pathnames –from the root directory - absolute pathnames Simple pathnames consist of sequences of names separated by ‘/’ characters An example of a relative pathname:../myDoc.txt An example of an absolute pathname: /stud/ug/xxx04u/Documents/myDoc.txt

Where am I in the File Structure? pwd prints the pathname of the current working directory cd pathname changes current directory –with no argument it goes to the home directory

Where am I in the File Structure? (2) robin$ pwd /stud/ug/xxx04u robin$ cd UST robin$ pwd /stud/ug/xxx04u/UST robin$ pwd /stud/ug/xxx04u/UST robin$ cd.. robin$ pwd /stud/ug/xxx04u/ (root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt UST xxx02uxxx04u MVR Lecture1.ppt Lecture2.doc.profile

File handling commands – Viewing File Contents The cat [filename…] command displays the contents of the named files It reads the contents of the file(s) and outputs to the shell window with no arguments cat simply echoes back what you type at the keyboard there is no scrolling with the cat command more [filename…] lets you scroll through a file –also less [filename…]

Viewing File Contents (2) head displays the first 10 lines of a file tail displays the last 10 lines of a file

ls [pathname…] lists the contents of the named directories –with no argument, the current directory is listed mv pathname1 pathname2 moves a file from pathname1 to pathname2 –if pathname2 already exists, then its previous contents are lost –if not, then it is created Viewing and Changing Directory Contents

cp pathname1 pathname2 copies the contents of pathname1 to pathname2 –if pathname2 already exists, –then its previous contents are lost –if not, then it is created rm pathname removes files but not directories (be careful) Viewing and Changing Directory Contents (2)

mkdir pathname... creates a new directory –it fails if they already exist Manipulating Directories robin$ rmdir fred rmdir: directory “fred”: Directory not empty robin$ mkdir fred mkdir: failed to make directory “fred”; File exists rmdir pathname removes directories –it fails if they are not empty

Printing lpr pathname prints files –it goes to your default printer –you can specify a printer with the -P flag, for example lpr -Phet fred.ps do not send text files and program listings to laser printers do not send postscript files to line printers! Printing not configured on unnc-cslinux Most of these commands have many flags for specifying different options

More about pathnames Special symbols can be used in pathnames..the directory one level above this../.. the directory two levels above this. the current directory ~this user’s home directory ~usera specific user’s home directory *wildcard matching any string ?wildcard matching any single character

Relative and Absolute Pathnames Revisited (root) staffusrbinstudetc ResearchTeachingPrivate pgugitmasters xxxgtrxxx CUA Coursework1.txt CUA xxx02uxxx04u MVR Lecture1.ppt Lecture2.doc.profile /../../../stud You are here! /stud/ug/xxx04u.. /stud/ug../..../../../.. ~~xxx04u RelativeAbsolute./stud/ug/xxx04u/CUA

Security and file permissions A shared filestore needs a security mechanism to prevent the unauthorised reading and writing of files UNIX associates a permissions list with each file saying who can do what to it Each directory also has a permissions list How you can access a file depends upon its permissions list and those of all its parent directories

Permissions lists Specify who can do what There are three kinds of who: uthe user (owner) gmembers of the user’s group oothers - anyone else There are three kinds of what: rread wwrite xexecute

Permissions lists (2) Use ls -l to see permissions lists (think of –l as ‘long’) drwxr--r-- 1 gtr staff Sep 21 15:41 Labs drwxr--r-- 1 gtr staff Sep 21 17:43 Lectures -rw-r--r-- 1 gtr staff Oct 6 18:58 Outline.doc -rw-r gtr staff Oct 6 18:19 Intro.ppt

Permissions lists (3) Each permissions list is shown as ten characters:

Group’s permissions (read only) User’s permissions (read, write and execute) Others’ permissions (read only) File/Directory name File size Group that user is in User Date file was last modified/created Directory -rwxr--r-- 1 gtr staff Sep 21 15:41 cve_user drwxr--r-- 1 gtr staff Sep 21 17:43 Reports -rw-r--r-- 1 gtr staff Oct 6 18:58 Yr1Report.doc -rwxr--r-- 1 gtr staff Oct 6 18:19 plod_node_mgr

The effect of directory permissions Execute lets you change (cd) into that directory –(i.e. you are searching the directory) Read lets you list files in the directory –(i.e. you are reading the directory contents) Write lets you create and delete files –(i.e. you are writing to the directory contents) To use a file at all you must have execute permission on all of its parents (otherwise it is as if it doesn’t exist)

other parents up to the root file parent directory execute permission controls whether any files and directories below this point can be accessed at all permissions control whether files can be accessed at all, listed, created and deleted permissions control specific actions on this file

Setting and changing permissions -chmod chmod mode pathname is used to alter permissions lists Mode specifies a sequence of changes, each of the form who operation permission –who is u, g or o –operation is + (grant) or - (revoke) –permission is r, w or x Examples: chmod o-r g-r plan.doc chmod u+rwx Admin

The mode can also be a three digit octal number that is interpreted as a sequence of nine bits to set the whole permissions list at once: –chmod 644 progress.txt 644 is which is interpreted as rw- r-- r-- –chmod 777 progress.txt 777 is which is interpreted rwx rwx rwx –chmod 400 progress.txt 400 is which is interpreted as r Setting and changing permissions – chmod (2)

Setting and changing permissions – chmod (3) Files are created with a default permission –usually -rw- r-- r-- –depends upon the command used to create the file –set using the umask command

Setting and changing permissions – chmod (3) Files are created with a default permission –usually -rw- r-- r-- –depends upon the command used to create the file –set using the umask command

Nice quote 1 At a recent computer expo (COMDEX), Bill Gates reportedly compared the computer industry with the auto industry and stated, "If GM had kept up with technology like the computer industry has, we would all be driving $25.00 cars that got 1,000 miles to the gallon." (also size – you could fit a Rolls Royce on the head of a pin. )

Nice quote 2 In response to Bill's comments, General Motors issued a press release stating: If GM had developed technology like Microsoft, we would all be driving cars with the following characteristics: 1. For no reason whatsoever, your car would crash twice a day.

Next Lecture UNIX commands for handling files Regular Expressions and Searching files Redirecting output Bash facilities

Summary Manual Pages The UNIX filestore Pathnames Security and file permissions