Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Similar documents
Unix Filesystem. January 26 th, 2004 Class Meeting 2

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

commandname flags arguments

Welcome to getting started with Ubuntu Server. This System Administrator Manual. guide to be simple to follow, with step by step instructions

UNIX File Hierarchy: Structure and Commands

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

Outline. Structure of a UNIX command

Week 2 Lecture 3. Unix

CSCI 2132 Software Development. Lecture 4: Files and Directories

Mills HPC Tutorial Series. Linux Basics I

Introduction to Linux Part I: The Filesystem Luca Heltai

CHAPTER 1 UNIX FOR NONPROGRAMMERS

Introduction to the Linux Command Line

A Brief Introduction to Unix

Working with Basic Linux. Daniel Balagué

CS4350 Unix Programming. Outline

Introduction to Linux

5/8/2012. Creating and Changing Directories Chapter 7

Files

Files and Directories

CS246 Spring14 Programming Paradigm Notes on Linux

Essential Linux Shell Commands

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Course 144 Supplementary Materials. UNIX Fundamentals

Commands are in black

Introduction to Unix: Fundamental Commands

Unix Handouts. Shantanu N Kulkarni

Overview of the UNIX File System. Navigating and Viewing Directories

Chapter-3. Introduction to Unix: Fundamental Commands

You will automatically be in your user (home) directory when you login.

Overview of the UNIX File System

Introduction of Linux

Introduction to Linux

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Introduction to Linux

Getting your department account

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

Computer Systems and Architecture

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

The Directory Structure

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

AN INTRODUCTION TO UNIX

SECTION -C. Getting Started with UNIX

Introduction to Linux Basics

Chapter 6. Linux File System

Essential Unix and Linux! Perl for Bioinformatics, ! F. Pineda

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Operating Systems. Copyleft 2005, Binnur Kurt

Filesystem Hierarchy and Permissions

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Outline. File Systems. File System Structure. CSCI 4061 Introduction to Operating Systems

Filesystem Hierarchy and Permissions

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

CS197U: A Hands on Introduction to Unix

CISC 220 fall 2011, set 1: Linux basics

h/w m/c Kernel shell Application s/w user

INTRODUCTION TO LINUX

This section reviews UNIX file, directory, and system commands, and is organized as follows:

CS/CIS 249 SP18 - Intro to Information Security

Filesystem Hierarchy Operating systems I800 Edmund Laugasson

Std: XI CHAPTER-3 LINUX

Introduction to Linux

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

Getting Started with Linux

(a) About Unix. History

Linux/Cygwin Practice Computer Architecture

Introduction to UNIX command-line

Embedded Linux Systems. Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

Unix Workshop Aug 2014

Basic Survival UNIX.

Perl and R Scripting for Biologists

The UNIX Operating System. HORT Lecture 2 Instructor: Kranthi Varala

CSC209. Software Tools and Systems Programming.

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

Introduction to Linux

File System. yihshih

The UNIX File System

Introduction to Linux Workshop 1

Introduction: What is Unix?

The UNIX File System

Unix System Architecture, File System, and Shell Commands

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

CS Fundamentals of Programming II Fall Very Basic UNIX

Full file at

Introduction to Linux Basics Part I. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Lab Working with Linux Command Line

Lecture 2: The file system

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

Linux Command Line Primer. By: Scott Marshall

Software I: Utilities and Internals

INSE Lab 1 Introduction to UNIX Fall 2017

Physics REU Unix Tutorial

12/7/10 ATSC 212 UNIX ATSC 212 ATSC 212 UNIX

EECS2301. Lab 1 Winter 2016

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

Introduction to Linux

Transcription:

Unix File System Class Meeting 2 * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix File System The file system is your interface to: physical storage (disks) on your machine storage on other machines (NFS) input/output devices Everything in Unix is a file (programs, text files, peripheral devices, terminals) The filesystem provides a logical view of the storage devices Directory is a file to contain (references to) other files 2

Working Directory Working directory: your current position in the file system pwd (print working directory) command outputs the absolute path (more later) of your working directory Unless you specify another directory, a command will assume that you want to operate within the working directory 3

Home Directory Home directory: personal user space At login, your working directory will be set to your home directory The path (more later) to your home directory can be referred to by the ~ (tilde) symbol The home directory of user1 can be referred to by ~user1 4

Unix File Hierarchy / Root Directory: / Directories may contain plain files and other directories Result is a tree structure for the file system bin home etc user1 user2 cs2204 lab1txt lab2txt 5

Unix Paths Separate directories by the symbol / / Absolute Path start at the root and follow the tree Examples: /home/user1/textfile ~user1/textfile ~/textfile bin home etc user1 user2 textfile lab1txt cs2204 lab2txt 6

Unix Paths (cont) Relative Path start at working directory.. level above. working directory Examples: textfile cs2204/lab1txt../user2 / bin home etc user1 textfile user2 cs2204 lab1txt lab1text 7

Some Standard Directories / root directory /bin standard commands and utilities; executables /dev block and character device directory /etc host-specific configuration; host services /home users home directories /lib library directory /sbin system commands and utilities (needed to boot) /tmp temporary files /usr user utilities and applications; /usr/local/ /var system files that vary (logs, spools, email) 8

Changing Directories cd changes the working directory cd <directory_path> can use absolute or relative path names cd without any arguments is the same as: cd ~ Examples: cd /home/user1 cd../../user1 9

Partial Output of ls -lfa drwxrwxr-x 2 cs2204 cs2204 64 Aug 29 11:13./ drwxr-xr-x 2 cs2204 cs2204 64 Aug 22 17:29../ -rw-r--r-- 1 cs2204 cs2204 1994 Aug 27 10:42 announce.php drwxr-xr-x 2 cs2204 cs2204 64 Aug 22 12:45 assignments/ -rw-r--r-- 1 cs2204 cs2204 5773 Aug 22 08:23 calendar.php lrwxrwxrwx 1 cs2204 cs2204 0 Aug 29 11:12 home -> /home/courses/cs2204/ -rw-r--r-- 1 cs2204 cs2204 475 Aug 22 12:38 index.php drwxr-xr-x 2 cs2204 cs2204 64 Aug 24 16:24 labs/ drwxr-xr-x 2 cs2204 cs2204 64 Aug 24 16:07 notes/ -rw-r--r-- 1 cs2204 cs2204 1210 Aug 25 09:20 readings.php drwxrwxr-x 2 cs2204 cs2204 64 Aug 24 16:19 resources/ -rw-r--r-- 1 cs2204 cs2204 18524 Aug 22 11:58 syllabus.php permissions file type owner group number of hard links File size modified date filename 10

Types of Files Plain ( - ) Most files, binary or text Note: Unix doesn t recognize any special filename extensions Directory ( d ) Directory is actually a file Points to another set of files Link ( l ): Pointer to another file or directory Special b block device (disks, CD-ROM) c character device (keyboard, joystick) 11

File Ownership Each file has a single owner chown command can be used to change the owner; usually only root can use this command Each file also belongs to a single group Groups may have different permissions than everyone else 12

File Permissions Permissions are used to allow or disallow access to files or directories Three types of permission: Read ( r ) Write ( w ) Execute ( x ) Permission exists on three levels: User ( u ) Group ( g ) World ( o ) 13

File Permissions (cont) chmod <mode> <file(s)> chmod 700 textfile r w x user chmod g+rw textfile ugo r w x group +/- r w x world rwx g+rw changes permissions to 760 (octal) 14

File Modification Date Last time a file was changed Useful when... there are many copies of a file many users are working on a file touch command can be used to update the modification date to the current date (or to create a file if it does not yet exist) 15

Manipulating Files touch <file> create a new file or change last modified date mv <file1> <file2> rename file1 as file2 mv <file1> <dir> move file1 into the dir directory mv <file1> <dir/file2> move file1 into dir and rename as file2 cp <file1> [<file2> <dir> <dir/file2>] copy file with new name, into directory, or both rm [-i] <file(s)> remove file or list of files 16

Creating and Removing Directories mkdir <directory_name> create a directory rmdir <directory_name> remove directory only works for empty directories rm -r <directory_name> remove directory and all of its contents, including subdirectories, recursively (-r) 17

Creating Links ln -s <existing_file> <link_name> creates a symbolic link (-s) link_name is a pointer to existing_file, which may be in another directory or even on another physical machine omit -s to create a hard link must be in same physical partition of same device; link_name is another name for existing_file 18

Looking at File Contents cat textfile1 textfile2 short for concatenate output the contents of textfile1, then the contents of textfile2 less textfile scroll through textfile one screen at a time allows forward and backward scrolling and searching 19

Working with file names All of the commands covered here that take file names as arguments can also use wildcards * for any string, e.g. *.txt, obj*, a*.*? for any character, e.g. doc? [] around a range of characters, e.g. [a-c]* Many systems provide filename completion - press the TAB key 20

Getting Help on Unix Commands man <command_name> shows all of the documentation for a command (lessstyle output) apropos <keyword> shows you all of the commands with the specified keyword in their description locate <string> shows files whose absolute path contains string 21