Linux Linux File System.

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

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.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
The UNIX File System CS465. File Systems What is a file system? A means of organizing information on the computer. A file system is a logical view, not.
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
File Management System The way a user or application may access files Programmer does not need to develop file management software You take files for granted.
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.
Linux Commands LINUX COMMANDS.
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Guide To UNIX Using Linux Fourth Edition
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Manage Directories and Files in Linux
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.
Unix Basics Chapter 4.
Linux+ Guide to Linux Certification, Second Edition
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2011 by the Trustees of Indiana University except as noted.
The UNIX File System. The UNIX File A file is a container for storing information and data. Filename limited to 255 characters. Can’t contain / or NULL.
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
UNIX File System by Tero Toikkanen, CAP02S. UNIX Multi-user system Multi-user system Multi-tasking system Multi-tasking system Wide selection of tools.
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:
Chapter Two Exploring the UNIX File System and File Security.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
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.
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Managing Files CSCI N321 – System and Network Administration Copyright © 2000, 2007 by the Trustees of Indiana University except as noted.
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.
Linux Commands C151 Multi-User Operating Systems.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
Linux Filesystem WeeSan Lee. Roadmap Disk Partitions The Filesystem Filesystem Mouting & Umounting File Tree File Type File Permission.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
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
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.
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.
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.
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.
Chapter 2: Exploring the UNIX File System (For Tuesday Section) File and File Systems.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
Linux Filesystem Management
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 101 Training Module Linux Basics.
Linux file system "On a UNIX system, everything is a file;
C151 Multi-User Operating Systems
BIF703 File Permissions.
UNIX Basics Internet Technology.
Exploring the UNIX File System and File Security
Chapter 7 File and file System structure
Software I: Utilities and Internals
Linux Commands LINUX COMMANDS.
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

Linux Linux File System

Hierarchy Standard File Hierarchy Standard (FHS) Defines a standard set of directories for use by all Linux and UNIX systems. www.pathname.com/fhs

/bin contains binary commands for use by all users. /boot linux kernel and boot info /dev device files /etc system specific configuration files /home User home directories /lib shared program libraries /mnt empty – use for accessing fd0 cd /opt additional software programs /proc process and kernel info /root root’s home directory /sbin system binary commands (admin) /tmp temp files

/usr most system commands and utilities /usr/bin user binary commands /usr/games educational prog and games /usr/include C program header files /usr/lib libraries /usr/local local programs /usr/share files that are architecture indpt /usr/src source code /usr/X11R6 the Xwindow system /usr/local Location for most add programs

Navigating Commands: pwd current path ls –F man ls for extra flag options mkdir creates a new directory mv cps and moves files cp cps files Aliases are special variables in memory that point to commands

Navigating Cont’d rmdir or rm removes files or directories rmdir only if directory is empty use rm –rf to remove filled directory and force its completion. Finding files: locate first time use updatedb to create structure database find

Understanding PATH Special variable echo $PATH Most executable files stored in /bin or /sbin Scattered over 20 bin and sbin directories Ensure that users don’t have to provide full path names to all commands like ls Exists this special variable that is placed into memory each time a user logs into the Linux system.

PATH Cont’d PATH variable lists dir’s that are searched for executable files if a relative or absolute pathname was not specified. User types ls System recognizes not an absolute pathname Looks for ls executable which is found in /bin with other commands Use which command to for location – which grep

Linking Files Files may be linked in two ways One file may be simply a pointer or a shortcut (symbolic link) Or two files may share the same data (hard link) To understand linking must know how files are stored on this filesystem.

On a structured level, a filesystem has three main sections: The superblock The inode table Data blocks

Superblock Contains info about the filesystem in general, such as number of inodes or data blocks Also how much data a data block stores in KB’s

inode Table Consists of several inodes(information inodes); Each inode describes one file or directory on the filesystem Contains unique inode # for identification Most imp – inode stores info such as the file size, data block locations, last modified date, perms, and ownership.

Data Blocks The data that makes up the contents of the file as well as the filename are stored in data blocks. They are referenced by the inode. Blocks are known as allocation units because they are the unit by which disk space is allocated for storage.

Hard Linked files Are direct copies of one another, as they share same inode and inode #. All files are same size, when one is modified the other is updated as well. You can hard-link a file an unlimited number of times, however all must reside on the same filesystem. Create a hard-link using the ln command.

ln command Exp: file1 file2 – need to be linked Use ln file1 file2 Creates the file 2 and links to file1 both have same inode # Deleting a hard-linked file does not delete all the other ln’d files

Symbolic Link Different from hard-linked because do not share same inode and inode # with their target file. Merely a pointer to the other and thus both files have different sizes. Data blocks contain only the pathname to the target file. Editing a sym linked file you are actually editing the target file. Thus if target file is deleted, then the sym link servers no function.

File / Directory Perms Whoami command shows who you are logged in as Groups command – what groups you belong to chown change ownership of files / dir’s chgrp change groups chmod change file mode

Mode Section of inode that stores permissions is called mode of the file and is divided into three sections based on the user’s that rec the perms to the file or dir. User (owner) perms Group (group owner) perms Other (everyone else on Linux system) perms

Mode rwxrwxrwx rwx read write execute Also three regular permissions: Read Write Execute rwxrwxrwx rwx read write execute First 3 User, next 3 group next other

drwx------ 3 root root 4096 Apr 8 07:12 Desktop User has r/w/x for owner root and this is a dir. Read – allows user to open / read the contents of a file Write – Allows user to open/read/edit contents Execute – Allows user to execute the file in memory and shell scripts

Imp not to give x perms to files that are not programs or shell scripts. Ensures that files will not be x’d accidentally causing the shell to try to interpret its contents.

Changing perms Use chmod two methods: u(user) + adds perm r(read) g(group - removes perm w(write o(other) = equal x(execute) a(all cats) Org file perms –r---w---x Change file from rw-r--r-- must add write perms to the user, add read perms and take away w for group and add read and take away x for other

So…chmod u+w,g+r-w,o+r-x file1 Remember ugoa Or use = criteria chmod u=rw,g=r,o=r file1 Or use a if perms to be changed are identical for user, group and other chmod a+x file1

Other Method All perms are stored in the inode of a file or directory as binary powers of two: Read = 2^2 = 4 Write = 2^1 = 2 Execute = 2^0 = 1 Thus rwxrwxrwx is 421421421

rwx 4+2+1 = 7 rw- 4+2=6 r-x 4+1=5 r-- 4 -wx 2+1=3 -w- 2 --x 1 --- 0

Exp: r-xr----- use chmod 540 file1 rw-r--r--use chmod 644 file1

Special Perms SUID (Set user ID) SGID (Set group ID) Sticky bit SUID – has no special function when set on a directory, however if set on a file and the file is executed, then the person who executed the file temp becomes the owner of the file.

For exp: ping command – used test network connectivity For exp: ping command – used test network connectivity. Person executing becomes temp owner. Ensures that specific root owned commands will be able to be used by other users. SUID can only be applied to binary compiled programs. Cannot be applied to shell scripts – security hazard.

SGID Has a function when applied to both files and dir’s. Allows reg users to execute binary compiled programs and become a member of the group attached to that file. When placed on a directory, user creates a file if SGID perms set – user’s name will still become the owner but directories group will become the group of the file.

Sticky bit Used in the past on files to lock them in memory. Today – Assists in setup of common directories – recall that if a write perm is applied to a dir – allows one to add and remove files – thus one could still delete all the files in that dir. If sticky bit is applied to common dir then employees may add files but only delete those files that they have added not others.