Linux file system "On a UNIX system, everything is a file;

Slides:



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

CS 497C – Introduction to UNIX Lecture 11: - The File System Chin-Chih Chang
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.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
Linux+ Guide to Linux Certification, Second Edition
Linux Linux File System.
Linux Files. Files and directories As in Windows directories are structures which contain –Other directories –Files.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
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
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
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
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.
Unix Basics Chapter 4.
Linux+ Guide to Linux Certification, Second Edition
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.
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.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
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.
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.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
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.
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.
Chapter Linux Basics. Acknowledgements This presentation was prepared by – Banyat Settapanich – Bahran Madaen This presentation will be updated later.
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.
LINUX Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
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
Linux 201 Training Module Linux Adv File Mgmt.
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.
Lecture 2 Working with Files and Directories
Some Linux Commands.
C151 Multi-User Operating Systems
9 Linux on the Desktop.
BIF703 File Permissions.
Basic UNIX OLC Training.
Exploring the UNIX File System and File Security
Chapter 7 File and file System structure
UNIX Commands A Brief Look at Common UNIX Commands.
UNIX Commands A Brief Look at Common UNIX Commands.
Perl Scripting and The File system
Module 6 Working with Files and Directories
Software I: Utilities and Internals
Lab 2: Terminal Basics.
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

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: files that are lists of other files. Special files: the mechanism used for input and output. Most special files are in /dev. Links Sockets and Named pipes: files are used to pass information between applications amongst other applications

The -l option to ls displays the file type File types in a long list Symbol Meaning - Regular file d Directory l Link c Special file s Socket p Named pipe

File system layout / bin boot dev etc home lib mnt opt proc root sbin tmp usr var

each subdirectory of root have special roles(By tradition): /bin: executable commands /sbin: sys adm commands /etc: system configuration files /lib shared libraries /dev peripheral devices /tmp temporary files /mnt to mount external devices /var Storage for all variable files and temporary files created by users, such as log files /proc system information /usr/bin further exe files /usr/sbin further system-important exe files /usr/lib further libraries User-installed programs typically go under the /usr/local hierarchy

The df command [alaei@node65 ~]$ df -h Using the df command with a dot (.) as an option shows the partition the current directory belongs to, [alaei@node65 ~]$ df -h .

The file system in reality In a file system, a file is represented by an inode, a kind of serial number containing information about the actual data that makes up the file: to whom this file belongs, and where is it located on the hard disk. use ls -i to disply indoe numbers

Orientation in the file system The PATH environment variable lists those directories in the system where executable files can be found [alaei@node65 ~]$ echo $PATH Linux searches for required program in paths and as soon as a match is found, the search is stopped The which command The export command The env command

Absolute and relative paths A path, which is the way you need to follow in the tree structure to reach a given file, can be described as starting from the trunk of the tree (the / or root directory). In that case, the path starts with a slash and is called an absolute path In the other case, the path doesn't start with a slash and confusion is possible between ~/bin/wc (in the user's home directory) and bin/wc in /usr. Paths that don't start with a slash are always relative. In relative paths we also use the . and .. indications for the current and the parent directory ~ means usr home directory

Manipulating files more about ls ls -l ls -ltr In most UNIX commands, options can be combined Color ls default color scheme Color File type blue directories red compressed archives white text files pink images cyan links yellow devices green executables flashing red broken links

Crating and deleting files and directories nautilus: The default file manager in Gnome, the GNU desktop. konqueror: The file manager typically used on a KDE desktop. mc: Midnight Commander, the Unix file manager

creating directories mkdir mkdir -p : creating directories and subdirectories in one step [alaei@node65 ~]$ mkdir -p project/iut/1 [alaei@node65 ~]$ mkdir 1 2 5

mv can rename files or directories, or move Copying files with cp -i, interactively prompt before overwriting files -R, -r, --recursive copy directories recursively Moving Files with mv mv can rename files or directories, or move them to different directories -f, force overwrite, even if target already exists -i, ask user interactively before overwriting files

-f, delete write-protected files without prompting Deleting Files with rm -f, delete write-protected files without prompting -i, interactive ask the user before deleting files -r, recursively delete files and directories There is no recycle bin in shell so s file is really gone when you use rm

Finding Files with locate The locate command is a simple and fast way to find files The locate command searches a database of filenames The database needs to be updated regularly Usually this is done automatically with cron But locate will not find files created since the last update Options: -i option makes the search case-insensitive -r treats the pattern as a regular expression, rather than a simple string

Finding Files More Flexibly: find find <path> name <searchstring> [alaei@node65 ~]$ find . -name test [alaei@node65 ~]$ find . size +5000k

The grep command The diff command The tkdiff command

File Security Owner Group Others d r w x r w x r w x Execute File type Write .= file d= directory l= link Read

Each type of permission is assigned a access mode code: read = 4 or r write = 2 or w execute = 1 or x User group codes user = u group= g others= o

The id command Print information for USERNAME, or the current user. The chmod command Operation + add - remove = set exactly

Before: -rwxr-xr-x  archive.sh Command: chmod o=r archive.sh After: -rwxr-xr--  archive.sh Before: -rw-r-----   topsecret.inf Command: chmod g= topsecret.inf After: -rw-------    topsecret.inf Before: -rw-r--r--    publicity.html Command: chmod og=rw publicity.html After: -rw-rw-rw-   publicity.html

$ chmod u=rw,g=r,o=r test_file -rw-r--r-- 1 eric users $ ls -l test_file -rw-r--r-- 1 eric users $ chmod o-r test_file $ ls -l test_file -rw-r----- 1 eric users $ chmod g+wx test_file $ ls -l test_file -rw-rwx--- 1 eric users $ chmod u=rw,g=r,o=r test_file -rw-r--r-- 1 eric users For changing file permissions in directory trees use -R. $ chmod -R g-w test_dir

6 = read + write (but not execute) 5 = read + execute (but not write) $ chmod 754 test_file -rwxr-xr-x 1 eric users Owner = 4 + 2 + 1 = 7 Group = 4 + 1 = 5 World = 4 = 4 The permission numbers are determined by adding the values of the allowed permissions: 7 = read + write + execute 6 = read + write (but not execute) 5 = read + execute (but not write) 3 = write + execute (but not read) 4 = read (but not write and execute) 2 = write (but not read or execute) 1 = execute (but not read or write)

The newgrp , chown and chgrp commands